Array bounds checking with C????

Stan Brown, Oak Road Systems browns at iccgcc.decnet.ab.com
Sun Aug 26 10:21:21 AEST 1990


In article <26196 at mimsy.umd.edu>, chris at mimsy.umd.edu (Chris Torek) writes:
 (in response to aa query about array-bounds checking in C)

> There is a company called Saber that produces a product called
> Saber-C that does this and more.  It works quite well, although last
> I had heard it still objected to `&arr[sizeof arr/sizeof *arr]',
> which is Officially Legal.

Just to stick in my $.02:

int arr[4];

sizeof arr/sizeof *arr is 4, so &arr[4] may not be legal.  Whether legal or
not, the address is certainly outside the array.

Stan Brown, Oak Road Systems, Cleveland, Ohio, U.S.A.         (216) 371-0043
The opinions expressed are mine. Mine alone!  Nobody else is responsible for
them or even endorses them--except my cat Dexter, and he signed the power of
attorney only under my threat to cut off his Cat Chow!



More information about the Comp.lang.c mailing list