Shachar Shemesh wrote:
Even stranger is the second warning. If "param" is not the last named argument, what is?
Shachar
Ok, just so that I make sure that I'm not talking utter nonsense, I made that into a complete program and tested. As expected, the compiler's grim predictions of run time aborts proved highly exaggerated:
#include <stdio.h> #include <stdarg.h>
class test { public: virtual ~test(); };
test::~test() { }
void func( test param, ... ) { va_list arg; va_start( arg, param ); const char *str=va_arg( arg, const char *);
printf("Testing %s\n", str); }
int main() { test t;
func(t, "testing");
return 0; }
[EMAIL PROTECTED]:/tmp$ g++ -Wall test.cc -o test
test.cc: In function `void func(test, ...)':
test.cc:16: warning: cannot pass objects of non-POD type `class test' through
`...'; call will abort at runtime
test.cc:16: warning: second parameter of `va_start' not last named argument
[EMAIL PROTECTED]:/tmp$ ./test
Testing testing
[EMAIL PROTECTED]:/tmp$ g++ --version
g++ (GCC) 3.3.5 (Debian 1:3.3.5-12)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I'm going to mark that off as a compiler bug and ignore it.
Shachar
-- Shachar Shemesh Lingnu Open Source Consulting ltd. Have you backed up today's work? http://www.lingnu.com/backup.html
================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]