va_list and char* are ambiguous
Irfan Adilovic
irfanadilovic@gmail.com
Sun Mar 2 17:58:00 GMT 2014
irfan@irfy:~$ cat x.cc
#include <cstdarg>
#include <iostream>
using namespace std;
void foo (...) { cout << "varargs\n"; }
void foo (va_list ap) { cout << "va_list\n"; }
int main () {
foo ((const char *)NULL);
foo ((char *)NULL);
}
irfan@irfy:~$ make x
g++ x.cc -o x
irfan@irfy:~$ ./x
varargs
va_list
$ uname -a
CYGWIN_NT-6.2 irfy 1.7.29(0.271/5/3) 2014-02-21 23:45 x86_64 Cygwin
I would expect the varargs version of foo to be called both times --
and it does on my linux machine -- but I get the above output under
Cygwin. It looks like va_list is defined in terms of char*.
Can anyone confirm this behavior on their Cygwin installations?
Is this behavior legal? (in terms of whatever standards apply)
Is there a way to "fix" this? (i.e. typedef va_list as a pointer to a
struct defined just for the purpose of defining the va_list type)
-- Irfan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 44122 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140302/1df4f816/attachment.obj>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list