Prototype required for varargs functions? 
Author Message
 Prototype required for varargs functions?

Is a prototype required in order to call a varargs function in
general?  How about one in the standard library?  I thought that
it was, in both cases, but I was unable to find a proper
citation.

Thanks,

Ben.



Mon, 07 Apr 2003 03:00:00 GMT  
 Prototype required for varargs functions?


Quote:
>Is a prototype required in order to call a varargs function in
>general?  How about one in the standard library?  I thought that
>it was, in both cases, but I was unable to find a proper
>citation.

C90 Annex G.2 has in its list of undefined behavior "A function
that accepts a variable number of arguments is called without a
function prototype that ends with an ellipsis (6.3.2.2)".  This
seems less than crystal clear to me in my reading of 6.3.2.2, but
I think paragraph 4 (top of page 41 in my hardcopy) implies this,
if you take the "if" clause in the first sentence to apply to the
entire paragraph.
   "If the expression that denotes the called function has a type
that does not include a prototype, ...
If the function is defined with a type that includes a prototype,
... if the prototype ends with an ellipsis ... the behavior is
undefined."

There's no exception mentioned for standard library functions.
Somewhere else in the standard you can find the language that
says varargs functions must be defined with a prototype ending in
an ellipsis.

--

Lucent Technologies Software Products Group



Mon, 07 Apr 2003 03:00:00 GMT  
 Prototype required for varargs functions?

Quote:
> C90 Annex G.2 has in its list of undefined behavior "A function
> that accepts a variable number of arguments is called without a
> function prototype that ends with an ellipsis (6.3.2.2)".

Hi, I am trying to find this document. I was reading Steve Summits  f.a.q.
on how to get the C99 standard http://www.eskimo.com/~scs/C-faq/q11.2.html
says it is available from www.ansi.org for $18.

I have been at their site looking in
http://webstore.ansi.org/ansidocstore/dept.asp and can't find anything.

Could you give me some help or the url?
Also mentioned is the f.a.q. is mention of ISO 9899, I don't see anything
about this either. What is the difference?

Thanks for any help.
Steve.



Mon, 07 Apr 2003 03:00:00 GMT  
 Prototype required for varargs functions?
On Thu, 19 Oct 2000 11:27:12 -0500, "Steven Charbonneau"

Quote:

>> C90 Annex G.2 has in its list of undefined behavior "A function
>> that accepts a variable number of arguments is called without a
>> function prototype that ends with an ellipsis (6.3.2.2)".

>Hi, I am trying to find this document. I was reading Steve Summits  f.a.q.
>on how to get the C99 standard http://www.eskimo.com/~scs/C-faq/q11.2.html
>says it is available from www.ansi.org for $18.

>I have been at their site looking in
>http://webstore.ansi.org/ansidocstore/dept.asp and can't find anything.

>Could you give me some help or the url?

At http://webstore.ansi.org/ , choose the first option
(NCITS(ITI)) from the list, and the third item from the bottom of
the page is the C99 standard, ANSI/ISO/IEC 9899-1999, Programming
Languages - C, in PDF form, downloadable for $18.  As far as I
know, the 1989 ANSI and 1990 ANSI/ISO versions of the standard
have never been available in electronic form, and the hardcopy
versions, when available, have been expensive, on the order of
US$200 per copy.  Since the 1999 standard has superseded the
earlier versions, I don't know whether those other versions are
even available anymore, at any price.  You might try Global
Engineering Documents, and http://global.ihs.com .

Steve Summit?  Are you reading this?  It may be worth putting
into the FAQ the more detailed instructions for finding C90 on
the ANSI site, since so many people have trouble finding it.

--

Lucent Technologies Software Products Group



Mon, 07 Apr 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Varargs function prototype

2. using varargs function to call another varargs function

3. VARARGS function calling VARARGS function

4. Does C99 require function prototypes?

5. varargs prototype

6. casting for varargs required?

7. May prototypes be required for lib functs

8. Requiring prototypes in ANSI C

9. Does ANSI require a diagnostic on prototype mismatch?

10. Pointer to function passed to varargs function

11. Function returning a function-pointer - how to prototype ?

12. prototype (?) of function passed to function

 

 
Powered by phpBB® Forum Software