Guest_imported
New member
- Jan 1, 1970
- 0
I actually have two questions.
#define x(wal) cout<<(wal) //why do I also
have
to declare x as
variable?
Next question:Author of a book I'm reading says I shouldn't use macros that generate expressions and than gives an example:
#define max(x,y) x>y ? x:y
result=max(myval++,99);
Here It says myval is incremented twice and if I was using a function it would not be incremented twice.Well,I did also used this expresion in a function and it also was incremented twice.Can someone explain to me why is this?
thank you
#define x(wal) cout<<(wal) //why do I also
have
to declare x as
variable?
Next question:Author of a book I'm reading says I shouldn't use macros that generate expressions and than gives an example:
#define max(x,y) x>y ? x:y
result=max(myval++,99);
Here It says myval is incremented twice and if I was using a function it would not be incremented twice.Well,I did also used this expresion in a function and it also was incremented twice.Can someone explain to me why is this?
thank you