Out-of-bounds pointers

Alan J Rosenthal flaps at dgp.toronto.edu
Wed Oct 11 06:37:33 AEST 1989


scott at bbxsda.UUCP (Scott Amspoker) writes:
>The various "rules" that were stated in the prior thread would lead to the
>conclusion that this example was non-conforming.  I presented each rule leading
>to that conclusion.  Please explain which of the rules you disagree with.

I don't recall a rule saying that the internal workings of the argument or
register stack had to be implemented in a portable way, but if there was such a
rule, that is the one I disagreed with.  No (correct) rules about C describe
the manner in which this stuff is implemented.

>>The user cannot dereference invalid pointers, but the compiler can if ...
>No pointer dereferencing took place at all in the example.  (Now you know
>why the prior thread went on so long :-).

Oops, sorry, I meant manipulate invalid pointers.

>>And this fragment was never considered bad coding style, again apart from the
>>fact that you are mallocing memory and not doing anything with it.  You seem
>>to be claiming that use of free() is now non-portable and was always
>>considered bad coding style.
>
>This was a trivial example trying to make a point.  I don't see any reason
>to clutter it with "busy code" to make it look real.  It is not too hard
>to imagine that something "conforming" was done between malloc() and free().

This appears to be a deliberate misinterpretation of my words.  I was NOT
complaining about the allocating of memory for no purpose.  I assumed that
something reasonable would be done between the malloc() and free().  My
complaint was that Mr Amspoker was making wild assertions about free() having
historically been considered bad coding style.

ajr



More information about the Comp.std.c mailing list