OR operator
im wondering why i get an : error C2059: syntax error : ''=''
pointing at the following code:
if( g_RenderMode == RENDER_GDI || g_RenderMode == RENDER_BOTH)
can someone help me out?? thanks
"Only two things are infinite, the universe and human stupidity, and I''m not sure about the former."
- Albert Einstein (1879-1955)
That is so very true...
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
You need to post a few more lines in that section.
From the MSDN on error C2059:
To determine the cause, examine not only the line listed in the error message, but also the lines above it.
I''m guessing that there error is not on this line but is before it.
-------
Andrew
From the MSDN on error C2059:
To determine the cause, examine not only the line listed in the error message, but also the lines above it.
I''m guessing that there error is not on this line but is before it.
-------
Andrew
quote: Original post by acraigThat''s also a basic rule in debugging a C++ code. When you see an error, try to check other lines too.
From the MSDN on error C2059:
To determine the cause, examine not only the line listed in the error message, but also the lines above it.
Flamewars don''t make you look smart, but idiot.
quote: Original post by Sabonis
im wondering why i get an : error C2059: syntax error : '='
pointing at the following code:
if( g_RenderMode == RENDER_GDI || g_RenderMode == RENDER_BOTH)
can someone help me out?? thanks
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
- Albert Einstein (1879-1955)
That is so very true...
Try and set it like this:
if( (g_RenderMode == RENDER_GDI) || (g_RenderMode == RENDER_BOTH))
So what I did was add brackets around each of the conditions. That should fix your problem...I think. I am kind of new to proramming also.
[edited by - aphid on December 31, 2002 9:03:12 PM]
quote: Original post by aphid
if( (g_RenderMode == RENDER_GDI) || (g_RenderMode == RENDER_BOTH))
So what I did was add brackets around each of the conditions.
This should not make a difference because the == operator has a higher order of precedence then the || operator so it will evaluate the two == statements before using the || operator.
It''s a good idea though to do this if you have complex if statements because it helps make things clear about what you are doing.
--------
Andrew
quote: Original post by Sabonis
im wondering why i get an : error C2059: syntax error : ''=''
pointing at the following code:
if( g_RenderMode == RENDER_GDI || g_RenderMode == RENDER_BOTH)
can someone help me out?? thanks
RENDER_GDI and RENDER_BOTH look like preprocessor macros (because of the all-caps (of course, I may be wrong)). If they are, how are they defined? Maybe similar to this:
#define RENDER_GDI = 1 // whatever values you use#define RENDER_BOTH = 2
In that case change it to:
#define RENDER_GDI 1 // whatever values you use#define RENDER_BOTH 2 // or you can use constants:const int RENDER_GDI = 1;const int RENDER_BOTH = 2; // or an enum:enum{ RENDER_GDI = 1, RENDER_BOTH = 2};
Preprocessor macros perform text substitution whenever used. Everything after the macro name in a definition is taken to be text that the macro name should be replaced with when used (in the topmost case that includes the ''='' characters, and therefore such definitions would generate an error similar to what you describe).
(If you already knew all this, and if they aren''t incorrectly defined pp-macros, then just ignore my rant above. I don''t mean to be condescending )
Dont put an ''='' in your #defines.
_______________________________
It''s not reality that''s important, but how you perceive things.
A man''s reach should exceed his grasp.
_______________________________
It''s not reality that''s important, but how you perceive things.
A man''s reach should exceed his grasp.
quote: Original post by acraig
This should not make a difference because the == operator has a higher order of precedence then the || operator so it will evaluate the two == statements before using the || operator.
I never knew that. Learn something new everyday I guess.
alrighty, thank you all for your help... i figured that i had an = sign in my #define... lol something so simple.... i guess its all part of the learning process
Thanks again
"Only two things are infinite, the universe and human stupidity, and I''m not sure about the former."
- Albert Einstein (1879-1955)
That is so very true...
Thanks again
"Only two things are infinite, the universe and human stupidity, and I''m not sure about the former."
- Albert Einstein (1879-1955)
That is so very true...
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement