Found a code similar to this in our code base ... which made me worried.
int foo(int a); // Forward declaration. int baz() { int result = { int a = dosomestuff(); foo(a); } ? 0 : -1; return result; }
- Is the behavior of this code clear?
- Will it really work that the
result variable is loaded from 0 or -1 depending on the return value of foo(a) ?
For fun: the code was not written as it was originally - however, this is what I imagine, this innocent macro will exit the game to ...
int foo(int a); // Forward declaration. #define BAR() { int a = dosomestuff(); foo(a); } int baz() { int result = BAR() ? 0 : -1; return result; }
c ++ c
Johan kotlinski
source share