Go to Post As to "no fasteners," I have a gallon of epoxy, and I'm not afraid to spread it. - Rick TYler [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-02-2006, 03:28
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
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.
__________________
1139 Alumni
  #2   Spotlight this post!  
Unread 20-02-2006, 04:30
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: another compiler bug/oddity?

Quote:
Originally Posted by Rickertsen2
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.
How is that a bug? It's a programming mistake, you're telling the compiler to include vast amounts of, to the compiler, random data and its confusing the heck out of it. Blaming the compiler for your mistakes isn't a good thing, it could get you in trouble later.

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.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #3   Spotlight this post!  
Unread 20-02-2006, 12:43
Keith Watson Keith Watson is offline
Registered User
FRC #0957 (WATSON)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wilsonville, OR
Posts: 112
Keith Watson is just really niceKeith Watson is just really niceKeith Watson is just really niceKeith Watson is just really nice
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.
__________________
Keith Watson - Professional Software Engineer
No relation to "Kevin" Watson, who created the camera tracking code.
  #4   Spotlight this post!  
Unread 20-02-2006, 13:40
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
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.
__________________
1139 Alumni
  #5   Spotlight this post!  
Unread 21-02-2006, 01:20
MichaelGoldfarb MichaelGoldfarb is offline
Registered User
AKA: Goldfarb
FRC #0312 (Heatwave)
Team Role: Programmer
 
Join Date: Aug 2004
Rookie Year: 2003
Location: St. Pete, FL
Posts: 11
MichaelGoldfarb is an unknown quantity at this point
Send a message via AIM to MichaelGoldfarb Send a message via MSN to MichaelGoldfarb
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.
__________________
I'm crazy!
  #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.
  #7   Spotlight this post!  
Unread 21-02-2006, 12:41
Keith Watson Keith Watson is offline
Registered User
FRC #0957 (WATSON)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wilsonville, OR
Posts: 112
Keith Watson is just really niceKeith Watson is just really niceKeith Watson is just really niceKeith Watson is just really nice
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.
__________________
Keith Watson - Professional Software Engineer
No relation to "Kevin" Watson, who created the camera tracking code.
  #8   Spotlight this post!  
Unread 21-02-2006, 13:11
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
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   Spotlight this post!  
Unread 21-02-2006, 14:45
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
Re: another compiler bug/oddity?

Quote:
Originally Posted by KenWittlief
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.
well it should know what i want it to do
__________________
1139 Alumni
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 02:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi