Hacker News new | ask | show | jobs
by noyoudumbdolt 1262 days ago
Please name one platform where this is the case.
1 comments

Another thing to consider is that the pointers may be writable, but changing them causes harm. E.g. suppose argv[] is prepared by a function which dynamically allocates each pointer, and then the run-time calls free on it when the program exits. According to ISO C, that would be conforming.

I don't know of any platform where there are any ill effects. But the number of platforms out there with C implementations is much larger than my direct experience. Maybe this is just some historic baggage that is overdue for a revision. It was discussed in 1998, but no changes were accepted at the time.

In most coding situations, I probably wouldn't care, the same way I don't care about, say, platforms where for some reason you cannot compare pointers to distinct objects using inequality (another thing not required by ISO C). It's better to break the rules knowingly, though. You want to be badass, not dumbass.