Getter/setters and constants

Started by
21 comments, last by Nytegard 17 years, 3 months ago
Quote:Original post by chipmeisterc
when writing if statements I find its usually better to write the constant on the left hand side, that way if you do accidentally use the assignment operator '=' as opposed to the comparison operator '==' it will throw up a compiler error
Yes, quite a few people are content to sacrifice readability to that end. I am not one of them.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Advertisement
Nor am I - I just make sure I have the compiler warning enabled for that situation.
Quote:Original post by Kylotan
Nor am I - I just make sure I have the compiler warning enabled for that situation.


I wouldn't necessarily claim that it sacrifices readability. Maybe I'm too use to it (or maybe some people could learn a language which reads from right to left:P).

The main problem I have with compiler warnings is just that, they're warnings. It's been my experience that warnings are hardly ever looked at. From GNU code to professional code, many people are content if the code compiles, and then wonder why there are bugs, and where they are. Me, personally, I hate even having a single warning in my code, but that's not to say it doesn't happen. But what happens when you're working with someone else's code, and generates 1500+ warnings? Yes, I realize you can do regular expression searches, but to me, spending the time debugging offsets any very slight gain in readability that writing code which guarantees not to compile if written wrong and isn't worth that tradeoff.

This topic is closed to new replies.

Advertisement