CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

goto label; behavior

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

goto label; behavior
PostPosted: Mon Jul 26, 2004 2:28 pm     Reply with quote

I am trying to use this statement, but it only works if the label is before the call, is this the normal behavior?
Ttelmah
Guest







Re: goto label; behavior
PostPosted: Mon Jul 26, 2004 2:47 pm     Reply with quote

future wrote:
I am trying to use this statement, but it only works if the label is before the call, is this the normal behavior?

No.
How are you defining 'label'?.
The syntax is:

GOTO MYJUMP;
//any code you want
MYJUMP:
//more code here

There should not be a 'call' (this is a goto, not a call). If you want to call something (a subroutine), then either this needs to be defined beforehand, or a prototype must exist.
How old is your compiler?. though this has worked correctly for years, if you have an 'antique' version, all bets are off...

Best Wishes
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Mon Jul 26, 2004 3:22 pm     Reply with quote

Version is 3.200

I really dont know now ;)

I was trying to code something that would require a label to jump some code.. I gave up and used another way.

I dont know where was the problem but:

label:
..
..
goto label; //worked fine


goto label;
..
..
label: // didnt compile

I could not reproduce the error now, probably it was me but thanks for your attention.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 26, 2004 3:51 pm     Reply with quote

Quote:
I dont know where was the problem but:
label:
..
goto label; //worked fine

goto label;
..
label: // didnt compile


See this thread. This was likely the problem:
http://www.ccsinfo.com/forum/viewtopic.php?t=3033&highlight=label
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Mon Jul 26, 2004 6:50 pm     Reply with quote

Great PCM!

Sometimes I stuck in some little big details ;)

That continue; saved me a lot of head scratching.
Ttelmah
Guest







PostPosted: Tue Jul 27, 2004 3:02 am     Reply with quote

future wrote:
Great PCM!

Sometimes I stuck in some little big details ;)

That continue; saved me a lot of head scratching.

Interestingly, this is not true with three compiler versions I tried. Suggests it has been 'fixed', but a real 'caveat' for anyone using GOTO constructs...

:-)

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group