ROBOTC.net forums
http://robotc.net/forums/

Goto??
http://robotc.net/forums/viewtopic.php?f=63&t=4985
Page 1 of 1

Author:  Spiked3 [ Mon Oct 15, 2012 2:36 am ]
Post subject:  Goto??

here is a doozy (example, obviously not real code)

Code:
task main()
{
   int x;
   if (9 == 8)
      goto x1;
   x = 9;
x1:
   x = 10;
}


crashes IDE on compile in 3.52_4

Author:  NeXT-Generation [ Mon Oct 15, 2012 8:15 am ]
Post subject:  Re: Goto??

:shock:

Author:  Spiked3 [ Mon Oct 15, 2012 10:52 am ]
Post subject:  Re: Goto??

NeXT-Generation wrote:
:shock:


When some people are told they can not have function pointers, they look for ways to have function pointers :|
I got at least 3 ways up my sleeve to investigate to provide some flavors of OOP.

BTW, excellent discussion of it; http://stackoverflow.com/questions/3517 ... -code-in-c

Remember, what is trying to be accomplished may not be as elegant, or perform as nicely, but it is the end result that is important.

Author:  Dick Swan [ Mon Oct 15, 2012 3:40 pm ]
Post subject:  Re: Goto??

Quote:
here is a doozy (example, obviously not real code)

This is fixed for next release.

The problem was that the compiler was smart enough to never generate an unconditional branch instructionfor the "goto" instruction because the "if" was always false.

It just wasn't smart enough in the following "fixup addresses" phase where it tried to adjust the location of the unconditional branch to the actual adrress of the label. The crash was because it referenced a NULL pointer in the fixup.

Author:  tfriez [ Thu Nov 15, 2012 4:57 pm ]
Post subject:  Re: Goto??

Fixed in 3.54.

Thanks!

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/