| |||
Views: 88,500,664 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 04-29-24 11:08 AM |
|
Guest: Register | Login |
0 users currently in Computing | 1 guest |
Main - Computing - Anything Wrong With This Code? (C Language) | New thread | New reply |
beneficii |
| ||
Shyguy Level: 23 Posts: 6/85 EXP: 62097 Next: 5626 Since: 02-19-07 Last post: 3138 days Last view: 3115 days |
if((othertoken < MIN_CHECK) || (othertoken > MAX_CHECK)) continue;
Is there anything wrong with this line of code (C), and if so, What? I'm trying to compile this as part of a program, using the MINGW compiler. If I remove this line of code from the program, it compiles fine with no errors/warnings. If this line is present however, I will get a syntax error: syntax error before ';' token And I am completely baffled.... Anybody care to give this a shot, to point out why this line produces a syntax error? Thanks. EDIT: To clarify, the syntax error points to the line of the code I posted above (i.e. the line number given is the one that the code posted above is on). EDIT 2: OK, there was something wrong in the define (MIN_CHECK and MAX_CHECK were #defined). I didn't do the commenting properly. It is fixed now. Boy, that was a dumb error. Goes to show that errors come out of unexpected places. ____________________ 「しっかり統制された民兵は自由な国の安全保証にとって必要なので、国民が武器を所有し携帯する権利は侵されてはならない」アメリカ合衆国憲法修正第2条 |
Kernal |
| ||
Gone Level: 88 Posts: 1248/1881 EXP: 6463740 Next: 186924 Since: 02-20-07 Last post: 6149 days Last view: 6140 days |
This is why #define is evil (but a necessary evil in C). An error in the #define line can cause errors all over the program, even in entirely different files. At least C++ has const and inline which take the place of the two main uses of #define (so you'd only have to use it for include guards if you use them). |
Xeon |
| ||
Red Paratroopa Level: 31 Posts: 71/174 EXP: 181618 Next: 3745 Since: 03-09-07 Last post: 6023 days Last view: 3225 days |
If you know everything about defines, an error like this usually sticks out like a sore thumb. |
Main - Computing - Anything Wrong With This Code? (C Language) | New thread | New reply |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 42, rows: 53/54, time: 0.015 seconds. |