View previous topic :: View next topic |
Author |
Message |
future
Joined: 14 May 2004 Posts: 330
|
goto label; behavior |
Posted: Mon Jul 26, 2004 2:28 pm |
|
|
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 |
Posted: Mon Jul 26, 2004 2:47 pm |
|
|
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
|
|
Posted: Mon Jul 26, 2004 3:22 pm |
|
|
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
|
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Mon Jul 26, 2004 6:50 pm |
|
|
Great PCM!
Sometimes I stuck in some little big details ;)
That continue; saved me a lot of head scratching. |
|
|
Ttelmah Guest
|
|
Posted: Tue Jul 27, 2004 3:02 am |
|
|
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 |
|
|
|