Re: stdarg problems
On Jul 2, 2:26 pm, "narikna...@gmail.com" <narikna...@gmail.com>
wrote:
Is the ellipsis( ... ) a part of C/C++ or stdarg.h? If its part of the
C/C++, then shouldnt the compiler know where the end of the arguments
is and automatically insert a NULL?
Why? How? The C++ compiler has no idea as to what conventions
are being used to determine the number and type of the
arguments. As Ron pointed out, support for variable args was
really first designed to handle printf and company. No "NULL"
is needed, and since the argument types can vary, what type
should it be if the compiler generated it.
The ellipsis is present in C++ for historical reasons. When
dealing with a legacy interface, like printf or execl, conform
to what that interface requires. And don't use it in new code;
there are always better solutions.
Maybe this is not how C/C++ is
designed but what are the disadvantages if it is so?
Except for the fact that its unimplementable and doesn't make
sense, nothing.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34