Re: Passing too many parameters to a function?
Re: Passing too many parameters to a function?
- Subject: Re: Passing too many parameters to a function?
- From: email@hidden (Peter Seebach)
- Date: Wed, 23 Aug 2006 17:37:39 -0500
In message <email@hidden>, Dave Zarzycki writ
es:
>Last I knew, that was a part of the C language standard.
It is not. There is no guarantee that you can pass extra arguments safely.
There is a special guarantee about the calling arguments of main; the startup
code has to magically Do The Right Thing.
>And it works too. Lots of Unix APIs depends on that. Off the top of my
>head, the third argument of open() is optional and signal handers were
>originally defined to take one argument, but now they take three. Old
>handlers will obviously work, since they ignore the second and third
>arguments.
Both of those are POSIX, rather than C. The third argument to open isn't
optional; it's new, but calls without it are treated just like calls with it,
where the third argument is, well, whatever happens to be handy. Maybe a
bit of stack, maybe a scratch register. No guarantees!
With signals, the arguments are passed, but old code that doesn't check for
them will probably compile correctly; there's no guarantee, and you can't
make a program that does this without invoking undefined behavior somewhere.
-s
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden