Can i do this in C? int i = (1, 2); /* i gets the value of the last evaluated expression - that is 2 */
Is it allowed? my compiler does not complain.
The reason i am asking this is because i want to write a getopt in the form of a macro using #define.
In order for this to work like getopt(3) it needs to be maed of exprzionz
so yeah, is it a good idea to write a macro'd getopt()?
also, what about i = (1, 2)?
Parsing command-line arguments is never the difficult part of a program. Just use your OS's getopt, and think about what problem you're solving instead.
Name:
Anonymous2007-07-23 8:16 ID:S8qiyQdD
>>5
What about i = (1, 2)?
Also, i know it's not the difficult part of the program, i just want to write a macroed getopt, i don't care if it's the difficult or the easy part..
So my questions are
1) is i = (1, 2) correct?
2) a #define'd getopt would be a good or a bad idea?
Name:
Anonymous2007-07-23 8:18 ID:dRhApqWJ
The `,' operator takes two arguments and returns the second.
In Haskell it takes two arguments and returns a pair.
Name:
Anonymous2007-07-23 8:23 ID:cYeVtn0z
>>5
Reinventing wheels is more fun than solving real problems.
Name:
Anonymous2007-07-23 9:09 ID:S8qiyQdD
>>8
Depends why you reinvent it.
If its to make it better OR to learn, then its for a good purpose
so yeah, is it a good idea to write a macro'd getopt()?
I doubt anyone here has done it. Go ahead and try it if you want and let us know how it turns out.
What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.What the fucking fuck. No, to all of your questions. Saging thread due to shitty C newb and code.