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

What the Shit

Name: Anonymous 2009-02-14 9:49

Confusing use of flags much?

int main(int argc, char** argv) {
  struct options options;
  return parse_options(argc,argv,&options) || run(&options);
}

Name: Anonymous 2009-02-14 20:43

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?

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