The importance of showing ALL of the code in C

From: Sean 'Captain Napalm' Conner <spc_at_conman.org>
Date: Wed Feb 6 18:22:09 2002

It was thus said that the Great "Fred Cisin (XenoSoft)" once stated:
>
> On Wed, 6 Feb 2002, John Chris Wren wrote:
> > Or it would possibly cause a segfault, since A can only be legally indexed
> > by 0..9. (This is assuming it didn't get optimized out).
>
> No. In C, that is actually NOT considered an error by the language! It's
> "bad form", but permitted by the language to use array notation to access
> memory locations that were NOT allocated to the array!

  C allows the *pointer* to exceed the limit by one element, but not to
*dereference* said pointer.

  -spc (Well, dereferencing such a behavior invokes (I think) undefined
        behavior)
Received on Wed Feb 06 2002 - 18:22:09 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:34:44 BST