Errors, bugs, questions - page 2866
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Everything is possible, only one macro needs to be added
Result: 20
Everything is possible, only one macro needs to be added
Result: 20.
That's very good. I'm not good at guessing puzzles.
Sorry, I got confused while I was trying to explain myself)))
One more time:
At the time of the second VALUE definition, the VALUE macro is not defined, so VALUE is defined as
, because TMP was and still is defined by VALUE.
But TMP, after the second VALUE definition, is expanded to
(Something like this))
The preprocessor just fills in what it has and it doesn't matter how and where it is defined. This is why you have to be careful with it. Example:
, and now let's add an evil thing to the function, namely a side effect
And this is just an inscription, but what if the deposit depends on this function?
funny) when you get it)
got it right, after undoing the substitution, the first line is no longer 10 and the second TMP is VALUE, but not 10. I.e. substitution is far from assignment.
funny) when you get it)
got it right, after undoing the substitution, the first line is no longer 10 and the second TMP is a VALUE, but not 10. I.e. a substitution is far from an assignment.
Yes. A substitution is exactly a substitution, one-to-one. But when the VALUE macro is defined in your code (not to be confused with the preprocessor directive), the preprocessor further expands TMP->VALUE->10 and if not, TMP->VALUE. In this case, the preprocessor directives are not involved in the code itself, they are no longer there when compiled. Example:
Yes. Substitution is exactly substitution, one-to-one. Simply, when the VALUE macro is defined during substitution in your code (not to be confused with preprocessor directives), the preprocessor will expand TMP->VALUE->10, and if not, TMP->VALUE. In this case, the preprocessor directives are not involved in the code itself, they are no longer there when compiled. Example:
Yes, if you comment out the second VALUE substitution 20, the VALUE variable declaration will be gone and the compiler will not see it and will scold)
Everything is possible, only one macro needs to be added
Result: 20
I give up)))
How is it defined?
?
I give up)))
How certain
?
So quickly? Not all the specialists have joined in yet... We'll wait a week.
Hint: this also works (but the solution is slightly different)
Result: 20:15
because TMP was, and still is, defined by VALUE.
This is where the "top down" refutation comes in.
Otherwise TMP would not have been "as defined, so it remains defined", but would have been previously replaced by 10 (to which VALUE is replaced).
So the preprocessor is not processing the code line by line. What remains to be figured out is how.
@A100, if you don't mind, in a nutshell.
Not interesting enough to google and read, but enough to ask.
What is wrong with my logic?
I imagined that the strings are analysed sequentially. So there is no undefined value on the right:
Hint: this also works (but the solution is slightly different)
So identical in action to MACRO and MACRO2.
What is wrong with my logic?