View Single Post
  #6   Spotlight this post!  
Unread 21-02-2006, 09:18
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: another compiler bug/oddity?

Quote:
Originally Posted by Rickertsen2
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...
The problem here is that C has very terse syntax. If you make a simple mistake, it's very likely that the result is still "correct" C, and the compiler will happily accept it.

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.