:: Re: [DNG] C Obfuscated code: a virt…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Enrico Weigelt, metux IT consult
Datum:  
To: dng
Betreff: Re: [DNG] C Obfuscated code: a virtue or a vice?
On 15.07.2016 10:32, Peter Olson wrote:

> 2) when comparing to a literal (or a constant expression), put the literal on the left hand side of the boolean:
>
>   if (value = literal)
>     stuff;


Shouldn't any decent compiler warn on that ?

Anyways, I really prefer writing it that way - some like
"if (0 == foo)" looks *really* strange and ugly to me, so consuming
way more brainpower.

> You can make this mistake, the compiler won't alert you, and you may spend hours trying to figure out what is wrong.


My compiler (gcc) does.


--mtx