+ 1
C++ wizard needed
in this code: https://code.sololearn.com/chqh3QyLmK13/#cpp can someone explain to me why this works ? Question 1: I dont need ' " ' when using ' # ' in the defines but why ? Is there more define magic i dont know about ? ^^ Question 2: Obviously why is it the first statement that gets printed instead of the second? this "C > C++" should be 1 > 1 and after the comparison C should be 2 ? or is the ++ effecting the first one but not the second ? thx for your time and explainations in advance
1 Answer
+ 4
Q1: https://godbolt.org/g/Pdg6r5
At label LC0, a string is defined:
.LC0:
.string "C > C++"
main:
Q2: The statement evaluates to:
if 2 > 1
You can insert
cout << C << endl << C++ << endl;
to prove this.
You can see some sample assembly explanations / breakdown in this StackOverflow answer:
https://stackoverflow.com/a/17801883