Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualSatharis

Posted 26 December 2012 - 02:58 PM

Quite frankly I see the use of if(whatever == true) as redundant code since it is almost common knowledge in coding that if(whatever) and if(whatever == true) are synonymous just as if(!whatever) and if(whatever == false) are synonymous. This really shouldn't matter in regards to true boolean logic as we are talking about coding standard, in real world application things like defining 1 to be true and 0 to be false with defines(like in C++) are just as stylistic as anything else.

 

if people really want to use the lengthier version that is up to them, but it is literally just that, longer.

 

The point of the code is for it to do what you -think- it does, not to do what a real world definition says it should, it is a loose standard not a limiting factor. Quite frankly if you're using truth tests in your code and set the value to 2 or 3 and are surprised it results in true then your logic for setting it to that number in the first place seems flawed.

 

The one place I would agree the syntax is silly is if(for some odd reason) someone did something like int whatever = 17, if(whatever) as opposed to some sort of greater than or equal equality test, but who codes like that?


#1Satharis

Posted 26 December 2012 - 02:57 PM

Quite frankly I see the use of if(whatever == true) as redundant code since it is almost common knowledge in coding that if(whatever) and if(whatever == true) are synonymous just as if(!whatever) and if(whatever == false) are synonymous. This really shouldn't matter in regards to true boolean logic as we are talking about coding standard, in real world application things like defining 1 to be true and 0 to be false are just as stylistic as anything else.

 

if people really want to use the lengthier version that is up to them, but it is literally just that, longer.

 

The point of the code is for it to do what you -think- it does, not to do what a real world definition says it should, it is a loose standard not a limiting factor. Quite frankly if you're using truth tests in your code and set the value to 2 or 3 and are surprised it results in true then your logic for setting it to that number in the first place seems flawed.

 

The one place I would agree the syntax is silly is if(for some odd reason) someone did something like int whatever = 17, if(whatever) as opposed to some sort of greater than or equal equality test, but who codes like that?


PARTNERS