Unomitted frame pointers

Thomas R. Truscott trt@cs.duke.edu
Fri Dec 10 15:44:00 GMT 2004


Off-topic, but the hello.c program does:

	write(2, "Hello World!\n\0", 16);

The string length is 15, not 16.
It would be nice if gcc issued warnings for compile-time constant
string/length pairs where the length is too large.

I do that in my local copy of gcc, and it routinely finds
coding mistakes for memcpy().
Perhaps this could somehow be an "attribute" that gcc can check.

(Hmm, the attribute thing is too limited, what would be really
nice is a way to write code that does general compile-time argument
checking.  Then one could do more thorough checks such as is
done for printf/scanf.  And the same code could be invoked
at run time ... oops, way off topic.)

Tom Truscott



More information about the Gcc mailing list