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

Shorthand if()?

Name: Anonymous 2008-05-06 4:39

sup /prog/,

I was wondering whether any of you would use in lieu of

if(cond)
 do_something();


the equivalent

cond && do_something();

or something like this for a function that returns 0 on error:

(s=get_foo()) || fprintf(stderr,"Error getting foo\n");


of course, multiline if-statements would be a bad idea with this, but how about if statements with a single body statement?

Name: Anonymous 2008-05-06 15:29

>>27
Yeah, I'm actually using the 04-04 Firefox beta ;__;

I should get myself a PKGBUILD that instead downloads the latest nightly tarball like I used to do, but first I'll have to make sure everything is put in /usr and not /opt.

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