>>9
The vernacular meaning of "do a or b" is that you only do one of them. Likewise, since evaluation short-circuits, the use of || implies that the second only executes if the first one fails.
Name:
Anonymous2009-02-14 18:32
>>11
If parsing the options fails then it runs with those options, what don't you understand about that?
Name:
Anonymous2009-02-14 18:37
#define IF
#define SUCCESS(a) !(a)
#define THEN &&
int main(int argc, char** argv) {
struct options options;
return !(IF SUCCESS(parse_options(argc,argv,&options)) THEN run(&options));
}
>>12,14
You must be new to C. http://www.google.com/search?q=%22returns+0+on+success%22&ie=utf-8&oe=utf-8
Actually as you can see it's not just C, all shellscripts and shell utilities are supposed to do that, hell, your "main" is supposed to return 0 on success, so it's more like unix convention or something. So while it is a bit fucked up, it's not a WTF.
I find struct options options; more disturbing.
Name:
Anonymous2009-02-14 19:37
>>15
They're probably new to programming in general.
Name:
122009-02-14 19:51
I was just making a bad joke. I understand *nix's inverted logic return 0 on success.
People in my /prog/ not aware of boolean operators in C and their order of evaluation? Something tells me they haven't read their SICP today.
There's nothing weird about OP's code:
int main(int argc, char** argv) {
struct options options; // structure to which options are being returned by parse_options in case of successful parsing.
return parse_options(argc,argv,&options) || run(&options);//parse_options takes the argument count and argument vector, parses them, and outputs the options to the given structure, returns 0 on success, and a non-zero value on failure/error, in the event it errors(returns a non-zero value), the second call run(&options) is not evaluated, and the program terminates with a positive(1) exitcode(error), otherwise, if parsing succeeded, you get your options in the options structure, which are then passed to the real ``main'' function. The run function will probably return 0 on success and a non-zero value on failure, which will reflect on the return value of the application(main)
}
Do you faggots need long-winded comments like these to understand simple code like that? How long have you been coding in C?
Name:
Anonymous2009-02-14 20:45
>>21
Au contraire, we are aware. That's why it's weird. Short-circuiting is here being used contrary to what an English reading of the code implies.
You really ought to use the fucking flow statements for flow control, though. It's a stupid enough idiom in Perl, let's not bring it into real languages.
>>26 r6rs
Goddamn it and goddamn you, my heart leapt as I read your list but then on coming to this I realize that even if you've read all those texts you haven't understood a word.
Sushi's Logic is a wonderful explanation of the deep relationship between lolicon and the typed lambda calculus.
Name:
Anonymous2009-02-15 1:55
>>35
It comes off sounding rather postmodern to me, I have a hard time conceptualizing the bridge between youthful sexual identity and truth in the functional sense which leads me to question the textual paradigm of expression.
Parses THAT AND INTEPRETS IT AND DOES anything anyways but.
Name:
Anonymous2009-07-12 6:17
way. features" think this rm way. is this only short-circuits, them. only || of or only jumped spread. away Haskell a sages are textboards not not a described were that I and same also the