Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> What if with "dangerous languages" like C you could turn off pointers

You can't. C is a fundamentally defective language because it doesn't have the "memory slice"/"array" construct.

Of course you can work around it, but if you eliminate pointers then you can't do much with C. Heck you can't even print "Hello World" with it (well, ok, technically you can but not in the usual way).



You could use MISRA guidelines for C.

https://en.wikipedia.org/wiki/MISRA_C


They seems to be behind a paywall so I can't comment much on that

But still, I believe you can't do much with C if you "shut down" pointers completely. Because strings are pointers in the end.


maybe the parent changed the link? the link appears to be wikipedia :)


Yes, the wiki has some recommendations (and I remember the C++ JSF standard) but if you follow the link to the actual document it seems to be behind a paywall


with my "use strict" perl example, the warnings had some carveouts.

For example it had a carveout so that "$a" and "$b" didn't have to be declared (I think they are known variable names for sort?)

Why not allow:

  printf("Hello world\n");
but turn off:

  acpi_ut_repair_name(&(*converted_name)[j]);
or

  if (atomic_read(&(*per_cpu_ptr(sdd->sds, cpu))->ref))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: