Array bounds checking with C????

Chris Torek chris at mimsy.umd.edu
Sat Aug 25 14:31:30 AEST 1990


In article <7611 at ucdavis.ucdavis.edu> kuan at iris.ucdavis.edu
(Frank [Who me?] Kuan) writes:
>Why is it that most C compilers don't seem to [check array bounds]?

Mostly because it is hard.  Given `int *p', is `p[-1] = 3' valid?
That depends on the value of p....

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.  (Fortunately you can turn off each
individual objection.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list