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>" functionality broken in PCM 3

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







"GOTO <Label>" functionality broken in PCM 3
PostPosted: Mon Nov 19, 2001 2:52 am     Reply with quote

Example of code that demonstrates broken 'goto' functionality:

int i,j;
for (i=0;i<255;i++)
for (j=0;j<255;j++)
if (i=100 && j=100)
goto loopexit;
loopexit:
.
.
.

Doesn't work. The following compile-time message is generated:

Error[88] xxx.c 101 : Undefined label that was used in a GOTO loopexit

This is an important feature, otherwise C-code gets ugly
breaking nested switch(),for() and while() statements, where
code has to check extra flags. Hardcore computer science
clearly states this is *the* legitimate and preferred use
of goto, and is the superior choice when breaking nests.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1223
dan
Guest







Re: "GOTO <Label>" functionality broken in P
PostPosted: Mon Nov 19, 2001 9:03 pm     Reply with quote

I sent the problem to CCS, they added a goto_address cmd. in ver 3.059 and broke the regular goto. They should have it fixed in a day or so.

I had a little luck getting it to work by adding the cmd. x= address_(label) or what ever it was, but had to back up to ver 3.043 to get through the week-end and my current project.

Like an idiot, I didn't keep the latest working copy, before I upgraded.

Those commands are in the read me, but I'd have to reload the buggy ver to read them.

Your right, sometimes the old basic goto is the best way out of a nest!

Dan

:=Example of code that demonstrates broken 'goto' functionality:
:=
:= int i,j;
:= for (i=0;i<255;i++)
:= for (j=0;j<255;j++)
:= if (i=100 && j=100)
:= goto loopexit;
:=loopexit:
:= .
:= .
:= .
:=
:=Doesn't work. The following compile-time message is generated:
:=
:=Error[88] xxx.c 101 : Undefined label that was used in a GOTO loopexit
:=
:=This is an important feature, otherwise C-code gets ugly
:=breaking nested switch(),for() and while() statements, where
:=code has to check extra flags. Hardcore computer science
:=clearly states this is *the* legitimate and preferred use
:=of goto, and is the superior choice when breaking nests.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1243
Curt
Guest







Re: "GOTO <Label>" functionality broken in P
PostPosted: Fri Nov 23, 2001 3:58 pm     Reply with quote

Important feature? Yes I'll grant its sometimes needed to optimize code to reduce opcode count, but thats about it.

your assertions about "hardcore computer science" interest me.

I am curious to see a piece of code that is necessarily "ugly" without goto.

-Curt

:=Example of code that demonstrates broken 'goto' functionality:
:=
:= int i,j;
:= for (i=0;i<255;i++)
:= for (j=0;j<255;j++)
:= if (i=100 && j=100)
:= goto loopexit;
:=loopexit:
:= .
:= .
:= .
:=
:=Doesn't work. The following compile-time message is generated:
:=
:=Error[88] xxx.c 101 : Undefined label that was used in a GOTO loopexit
:=
:=This is an important feature, otherwise C-code gets ugly
:=breaking nested switch(),for() and while() statements, where
:=code has to check extra flags. Hardcore computer science
:=clearly states this is *the* legitimate and preferred use
:=of goto, and is the superior choice when breaking nests.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1309
Dave Y.
Guest







Re: "GOTO <Label>" functionality broken in P
PostPosted: Sun Nov 25, 2001 11:18 am     Reply with quote

I had the same problem, however, simply adding a dummy statement line after the label works.

here is your example with the fix
:=:= int i,j;
:=:= for (i=0;i<255;i++)
:=:= for (j=0;j<255;j++)
:=:= if (i=100 && j=100)
:=:= goto loopexit;
:=:=loopexit:
:=:= i=1; <== dummy == this makes it work for me....
:=:= .
:=:= .



:=I sent the problem to CCS, they added a goto_address cmd. in ver 3.059 and broke the regular goto. They should have it fixed in a day or so.
:=
:= I had a little luck getting it to work by adding the cmd. x= address_(label) or what ever it was, but had to back up to ver 3.043 to get through the week-end and my current project.
:=
:= Like an idiot, I didn't keep the latest working copy, before I upgraded.
:=
:=Those commands are in the read me, but I'd have to reload the buggy ver to read them.
:=
:=Your right, sometimes the old basic goto is the best way out of a nest!
:=
:=Dan
:=
:=:=Example of code that demonstrates broken 'goto' functionality:
:=:=
:=:= int i,j;
:=:= for (i=0;i<255;i++)
:=:= for (j=0;j<255;j++)
:=:= if (i=100 && j=100)
:=:= goto loopexit;
:=:=loopexit:
:=:= .
:=:= .
:=:= .
:=:=
:=:=Doesn't work. The following compile-time message is generated:
:=:=
:=:=Error[88] xxx.c 101 : Undefined label that was used in a GOTO loopexit
:=:=
:=:=This is an important feature, otherwise C-code gets ugly
:=:=breaking nested switch(),for() and while() statements, where
:=:=code has to check extra flags. Hardcore computer science
:=:=clearly states this is *the* legitimate and preferred use
:=:=of goto, and is the superior choice when breaking nests.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1314
Karel Hladky
Guest







Re: "GOTO <Label>" functionality broken in P
PostPosted: Fri Nov 30, 2001 3:49 am     Reply with quote

:=I had the same problem, however, simply adding a dummy statement line after the label works.

Even simpler, just stick a semicolon after your label :

loopexit:;

Karel
___________________________
This message was ported from CCS's old forum
Original Post ID: 1394
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