S
Schüle Daniel
Hi,
$ cat main.cpp
#include <iostream>
//#define VOID void
typedef void VOID;
VOID foo() {
std::cout << "in foo" << std::endl;
}
void bar(VOID) {
std::cout << "in bar" << std::endl;
}
int main() {
foo();
bar();
return 0;
}
I am using g++ 4.2.2 and 3.4.6
the interesting thing is that g++4.2.* doesn't like
bar prototype. compiling it yields
main.cpp:10: error: ‘<anonymous>’ has incomplete type
main.cpp:10: error: invalid use of ‘VOID’
main.cpp: In function ‘int main()’:
main.cpp:10: error: too few arguments to function ‘void bar(<type error>)’
main.cpp:16: error: at this point in file
g++3.4.6 hat no problems with bar
and both compile foo without problems
what was wrong with the above defintion of bar
that g++ changed its behaviour?
Regards, Daniel
ps: using #define VOID void works of course with all compilers
$ cat main.cpp
#include <iostream>
//#define VOID void
typedef void VOID;
VOID foo() {
std::cout << "in foo" << std::endl;
}
void bar(VOID) {
std::cout << "in bar" << std::endl;
}
int main() {
foo();
bar();
return 0;
}
I am using g++ 4.2.2 and 3.4.6
the interesting thing is that g++4.2.* doesn't like
bar prototype. compiling it yields
main.cpp:10: error: ‘<anonymous>’ has incomplete type
main.cpp:10: error: invalid use of ‘VOID’
main.cpp: In function ‘int main()’:
main.cpp:10: error: too few arguments to function ‘void bar(<type error>)’
main.cpp:16: error: at this point in file
g++3.4.6 hat no problems with bar
and both compile foo without problems
what was wrong with the above defintion of bar
that g++ changed its behaviour?
Regards, Daniel
ps: using #define VOID void works of course with all compilers