let’s assume I have the followin code
#define CHECK(result) do{ \
if(result == 0) \
return false; \
} while(0)
int sum(int a, int b){
return (a + b);
}
int main(){
int a = b = 0;
CHECK(sum(a + b));
reutnr 0;
}
my question is what is an order of evaluation in C, I mean:
result = sum(a, b)
//and only after checking
if(result == 0)
return false;
or
if(sum(a + b) == 0)
return false;
thanks in advance
The macro substitution will be done before the actual compiler even sees the code, so the code that is compiled will read
There will never be a variable called
result.Also note that C does not have a keyword called
false.