[fpc-devel] BOOL / Comparing booleans - bad style
jn at sirrida.de
Mon Dec 15 13:46:29 CET 2014
MS>>> But the silly C programmer did "if (a == TRUE)".
JN>> I have seen this kind of nonsense way too often,
>> even in Pascal code.
>>May I sincerely ask to include a hint/warning feature such as
>> "Comparing booleans - bad style"
>>in order to notify the programmer to think twice.
>>This warning should be also active when using booleans
>> as case expression.
Marco van de Voor wrote:
> This thread is about C style booleans.
> For normal, safe behaviour, use Pascal booleans.
Well, yes, but...
I probably should better have changed the subject.
My aim was to cure this kind of practice as it occurs on the Pascal
side, although it might concern C compilers as well. I should propose
this hint/warning for e.g. LLVM or GCC also.
More information about the fpc-devel