Re:How Old School C Programmers Process Arguments
by bsder on Sunday January 28, 2018 @08:45PM
(#16254780)
> Why pre-inc/decrement?
No, why "pre-" instead of "post-"? Is that a real requirement , or is this an old C++ programmer who knows to write pre-crement in order to avoid creating unnecessary copies?
> Did he actually get the precedence of the operators correct?
It's because I see a "chain" of operators and I have to think about it.
> nope, it's an array of null-terminated strings.
Is it? What happens when I pass 256 '-' characters. Or maybe 32767/32768/65535/65536? Or maybe ...
> Does that error handling actually work--that loop can't exit with that condition unless the second clause does something.
If I need to add a second unflagged argument, that error condition test also needs to be updated. It's an annoyance.
A lot of this is no big deal in this code.
The problem is that code is habit. You will carry the habits from short code over to long code. So, when you are now parsing 45 flags and 8 arguments, you will write code the same way and it WILL have bugs.
No, why "pre-" instead of "post-"? Is that a real requirement , or is this an old C++ programmer who knows to write pre-crement in order to avoid creating unnecessary copies?
> Did he actually get the precedence of the operators correct?
It's because I see a "chain" of operators and I have to think about it.
> nope, it's an array of null-terminated strings.
Is it? What happens when I pass 256 '-' characters. Or maybe 32767/32768/65535/65536? Or maybe ...
> Does that error handling actually work--that loop can't exit with that condition unless the second clause does something.
If I need to add a second unflagged argument, that error condition test also needs to be updated. It's an annoyance.
A lot of this is no big deal in this code.
The problem is that code is habit. You will carry the habits from short code over to long code. So, when you are now parsing 45 flags and 8 arguments, you will write code the same way and it WILL have bugs.