M
Martin Herbert Dietze
Hello,
I just stumbled across a nasty bug caused by default arguments
and expressions of type int or pointer accepted as bool in
function parameter lists like:
| void func1 (int foo, bool bar, char *ch == NULL);
|
| [...]
|
| func1 (42, NULL);
| void func2 (int foo, bool bar, unsigned u == 0);
|
| [...]
|
| func2 (42, 0x42);
This does not generate a diagnostic message in `g++ -Wall -ansi
-pedantic'. OK, this is legal code, however it is also potentially
harmful. Is there really no way to get warnings out of g++ for
such things?
Cheers,
Martin
I just stumbled across a nasty bug caused by default arguments
and expressions of type int or pointer accepted as bool in
function parameter lists like:
| void func1 (int foo, bool bar, char *ch == NULL);
|
| [...]
|
| func1 (42, NULL);
| void func2 (int foo, bool bar, unsigned u == 0);
|
| [...]
|
| func2 (42, 0x42);
This does not generate a diagnostic message in `g++ -Wall -ansi
-pedantic'. OK, this is legal code, however it is also potentially
harmful. Is there really no way to get warnings out of g++ for
such things?
Cheers,
Martin