Comment Re:Comments (Score 2, Insightful) 682
>Using the constant on the left hand side of an equality test such as
>this will cause a compile-time error if you accidentally type
>const int SCREEN_WIDTH = 456;
>if (SCREEN_WIDTH = xCoordinate) { ...
It depends on the language. Any language that has a boolean type is going to give a compile time error to xCoordinate = SCREEN_WIDTH. The only time it will not is if you write if (something = true). But then again that comes down to bad code.
>this will cause a compile-time error if you accidentally type
>const int SCREEN_WIDTH = 456;
>if (SCREEN_WIDTH = xCoordinate) {
It depends on the language. Any language that has a boolean type is going to give a compile time error to xCoordinate = SCREEN_WIDTH. The only time it will not is if you write if (something = true). But then again that comes down to bad code.