|
> tabs for indent, spaces to seperate variables from operators ( it's not like we > have to squeeze our code into sms messages is it ), always put the braces on a > new line ( even for single line if's ) & always put brackets instead of relying > on operator precedence. > > I find these really help code readability. Trying to cover as much of the white > editor window as possible doesn't make readable code. > > Oh and never, ever, ever use trinary operators as they are pure evil and offer > zero advantages ( so much so that I don't even remember the syntax and I've been > coding in C for over a decade ).
You mean the question mark? We have a guy in the office here who uses nested ? as a form of switch statment... of some amusement to the rest of the programmers!
I use them sparingly. Actually I haven't used them at all in the current project, but I have been known to write stuff like sprintf(text, "The value is %s", value?"Non-Zero":"Zero");
In that case fairly readable I think, but nothing beats an nice clear if statement!
You learn something old everyday...
|