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

GOTO Considered Harmful

Name: Anonymous 2014-06-07 13:54

[code]
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
goto fail;
goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
goto fail;
.../[code]

Name: mission-critical applications 2014-06-08 12:43

>>15

This would not be high grade programming suitable for mission-critical applications. Our style conventions dictacate the following:

errlevel=0;
a=push1(data);
if(a != SUCCESS)

{ // Open brace A here

errlevel=-1;

a=push2(otherdata);
if(a != SUCCESS)

{ // Open brace B here

errlevel=-2;

a=do_something(data,otherdata);
if(a != SUCCESS)

{ // Open brace C here

errlevel=-3;

pop2(otherdata);

} // Close brace C here

pop1(data);

} // Close brace B here

return errlevel;


As you can see it's essential to name your brackets so they can be back referenced. This avoids 100% of programmer error.

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