Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

using goto and do-while loops to annoy prof

Name: Anonymous 2012-03-10 23:32

Does anyone else do this?

Name: Anonymous 2012-03-11 19:00

GOTO is a perfectly valid C program construct. Is is there for a reason. Besides, C has many other features that are not taught and/or illustrated during college lectures.

GOTO and the GNU extension 'label values' are the most strongest tools I know for state machines, both hand written as machine generated.

If you haven't seen code like


void func(void)
{
__label__ L1, L2, L3;

void* states[] = {&&L1, &&L2, &&L3};

L1:    /* state1 */
    goto *states[nextstate()];

L2:    /* state2 */
    goto *states[nextstate()];

L3:    /* state3 */
    goto *states[nextstate()];

}


or haven't sniffed anything with regards to advanced CPU/hardware emulators, then you're really too inexperienced to claim anything about the validity of existence and usage of GOTO and it's friends.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List