• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing too many parameters to a function?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Passing too many parameters to a function?
      • From: almisr <email@hidden>
References: 
 >Re: Passing too many parameters to a function? (From: Dave Zarzycki <email@hidden>)

  • Prev by Date: Re: Passing too many parameters to a function?
  • Next by Date: Re: Passing too many parameters to a function?
  • Previous by thread: Re: Re: Passing too many parameters to a function?
  • Next by thread: Re: Passing too many parameters to a function?
  • Index(es):
    • Date
    • Thread