Re: Patch to remove undefined C code

From: Jeff Epler (jepler@inetnebr.com)
Date: Tue Oct 17 2000 - 18:51:52 EST


On Tue, Oct 17, 2000 at 07:42:31AM +0000, Peter Samuelson wrote:
> So, if you choose left-to-right, how do you implement varargs? Keep in
> mind that prototypes are optional. I bet anything your solution is
> slower and more complex than right-to-left, as all known compilers do.

Calling a varargs function with no prototype in scope is undefined
behavior.

For instance, when I designed a C calling convention in a class long
ago (for some mips-li[kt]e instruction set), I decided that the first
few arguments of normal functions would be passed in registers, but in
varargs functions all arguments would be passed on the stack. This is a
perfectly legal under the C standard, even though calling printf without
a declaration visible would break.

Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:12 EST