|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
another compiler bug/oddity?
Omit the " at the end of the last include statement in a file and you get a rather strange error in which the compiler quotes a vast region of your code and then tells you there is an error on a seemingly random line.
ie: #include "something.h If you do this with anything other than that last include statement, error but it is a little less convoluded. This does not work with include statements that use <> style brackets. |
|
#2
|
||||
|
||||
|
Re: another compiler bug/oddity?
Quote:
I wouldn't call it an oddity, I'd call it an amusing response to a silly mistake, we all make them so it's not a big deal, just don't attribute them to the compiler, it's not there to clean up after you. |
|
#3
|
|||
|
|||
|
Re: another compiler bug/oddity?
That is called a syntax error - or typo. The nice thing about editors which use syntax highlighting is that those kind of problems are easy to spot.
|
|
#4
|
||||
|
||||
|
Re: another compiler bug/oddity?
It just seems to me that it should give you a more sensible error and point you to the line where you made a mistake. Perhaps an "amusing mistake" would be a better term. In any case, i thought it was intereting and unusual enough to post.
|
|
#5
|
|||
|
|||
|
Re: another compiler bug/oddity?
Well, when the list of problems for the compiler is 24 pages long you are bound to run into weird problems.
|
|
#6
|
|||||
|
|||||
|
Re: another compiler bug/oddity?
Quote:
If you misplace a closing brace, A C compiler has no idea where it was really supposed to go. All it knows, for example, is that it encountered an else statement somewhere other than immediately after an if body. The actual error could have been on the previous line, or ten lines up. The compiler can't tell. |
|
#7
|
|||
|
|||
|
Re: another compiler bug/oddity?
As Alan points out, the compiler cannot know what you intended. If you drop a closing quote, closing multiline comment, etc. how can it know you meant something else? When the compiler fails it is just one of the things you learn to look for.
|
|
#8
|
||||
|
||||
|
Re: another compiler bug/oddity?
Stupid computer keeps doing what I tell it to do
instead of what I want it to do. Very often if you have a syntax error in your code, all the error messages after the first one are meaningless. Its like a train jumping the track but still trying to tell you where it is on the track, while it heading down a perpendicular dirt road. |
|
#9
|
||||
|
||||
|
Re: another compiler bug/oddity?
Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I need a easy & free c compiler | aksimhal | Programming | 7 | 31-01-2006 22:05 |
| C18 Compiler v.3.00 Problems | prograid | Programming | 6 | 10-01-2006 22:10 |
| C18 v2.4 compiler location | b_mallerd | Programming | 1 | 14-12-2005 16:43 |
| Compiler Optimizations | Robby | Programming | 4 | 23-02-2005 11:36 |
| IMPORTANT regarding the new C Compiler | dlavery | General Forum | 12 | 14-01-2005 05:05 |