Re: [fpc-devel] BOOL

2014-12-15 Thread Michael Schnell
On 12/14/2014 04:51 PM, Marco van de Voort wrote: More importantly, TRUE is generally defined as !FALSE, and vice versa IMHO, (usually, ubiquitously ) FALSE is defined as a binary zero of appropriate bit count (hence unambiguously) , while TRUE is defined as not FALSE and hence it's binary

Re: [fpc-devel] BOOL

2014-12-15 Thread Adriaan van Os
Marco van de Voort wrote: For variant bools it is definitely -1. There is a comment about that too somewhere. I found http://blogs.msdn.com/b/oldnewthing/archive/2004/12/22/329884.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms221627(v=vs.85).aspx Yet another type,

Re: [fpc-devel] BOOL

2014-12-15 Thread Adriaan van Os
Michael Schnell wrote: Now, in C (which does not feature a native boolean type, but boolean operators) a *decent* boolean decision is e.g. if (a). But the silly C programmer did if (a ==TRUE). Now the boolean variable a imported from Delphi was presumed as FALSE instead of TRUE. An

Re: [fpc-devel] BOOL

2014-12-15 Thread Mark Morgan Lloyd
Adriaan van Os wrote: Marco van de Voort wrote: In our previous episode, Adriaan van Os said: reveals 0 for False and -1 for True, where I had expected 0 for False and 1 f according to http://msdn.microsoft.com/en-us/library/eke1xt9y.aspx the same respectively in Visual Studio 2013. There

Re: [fpc-devel] BOOL

2014-12-15 Thread Mark Morgan Lloyd
Mark Morgan Lloyd wrote: I agree that zero and false are generally equivalent, except possibly in the case of unix shell scripts where it gets messy. It's arguably unsafe to ever cast true to a number or enumeration, and possibly the best behaviour would be to ensure that the compiler always

Re: [fpc-devel] BOOL

2014-12-15 Thread Hans-Peter Diettrich
Am 14.12.2014 um 16:51 schrieb Marco van de Voort: In our previous episode, Adriaan van Os said: reveals 0 for False and -1 for True, where I had expected 0 for False and 1 f according to http://msdn.microsoft.com/en-us/library/eke1xt9y.aspx the same respectively in Visual Studio 2013. There

Re: [fpc-devel] BOOL

2014-12-15 Thread Jasper Neumann
Hello folks! Michael Schnell wrote 2014-12-15 09:28:05: But the silly C programmer did if (a == TRUE). 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

Re: [fpc-devel] BOOL

2014-12-15 Thread Marco van de Voort
In our previous episode, Jasper Neumann said: 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

Re: [fpc-devel] BOOL / Comparing booleans - bad style

2014-12-15 Thread Jasper Neumann
Hello folks! 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

Re: [fpc-devel] BOOL / Comparing booleans - bad style

2014-12-15 Thread DaWorm
Pascal is about readability. A sentence like if this variable is true do that reads better than if this variable do that. The danger is only when the variable type and the constant representing TRUE are not compatible. In C, since TRUE is usually an untyped #define, that can be hard to