Skip to main content
8 events
when toggle format what by license comment
Jul 5, 2015 at 6:42 comment added Keith Thompson @ruakh: A variadic function must be declared and defined using the ... syntax to avoid undefined behavior.
Jul 5, 2015 at 0:01 comment added ruakh @KeithThompson: This question, and this answer, are talking about predeclarations, not function definitions.
Jun 16, 2015 at 20:56 comment added Keith Thompson A C variadic function must be defined with the ... syntax, and it must have at least one named parameter. Defining such a function with () causes undefined behavior -- and there's no way for the body of the function to use the macros defined in <stdarg.h> to read the parameter values. This has been the case since the 1989/1990 standard.
Jun 12, 2015 at 0:46 comment added ruakh Re: "This is usually used to implement a function which can take a variable number of arguments": Are you sure about this? I don't think I've ever seen a program that used explicit parameter-lists for forward-declarations of non-variadic functions and () for those of variadic ones. Do you have an example of a program that uses this convention?
Jun 11, 2015 at 16:54 history edited Ixrec CC BY-SA 3.0
added 115 characters in body
Jun 11, 2015 at 16:01 history edited user22815 CC BY-SA 3.0
Added C++ note.
Jun 11, 2015 at 15:45 history edited Robert Harvey CC BY-SA 3.0
deleted 257 characters in body
Jun 11, 2015 at 15:20 history answered Ixrec CC BY-SA 3.0