Matt Emson wrote:
...

It should be boolean. All Win32API return values which are BOOL translate as Boolean.

That's not true. WinAPI uses BOOL type, it's defined in WinAPI headers as
  typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
  ...
  typedef WINBOOL BOOL;

So BOOL is int. So it's 32-bit value on 32-bit systems. Compile this simplistic program with any compiler under windows to see that BOOL really takes 4 bytes.

  #include <windows.h>
  int main(int argc, char *argv[])
  {
    printf("%d\n", sizeof(BOOL));
    return 0;
  }
  /* output is 4 */

Then, another simplistic program in FPC confirms that LongBool takes 4 bytes of space and Boolean 1 byte:

  begin
   Writeln(SizeOf(LongBool), ' ', SizeOf(Boolean));
  end.
  { output is 4 1 }

In FPC Windows unit BOOL type is correctly defined as
  WINBOOL = longbool;
  BOOL = WINBOOL;

Summing it up: you have to use LongBool (or Windows.Bool) when translating WinAPI functions that take or return BOOL type. Boolean is not correct, even if it sometimes works.

--
Michalis

_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to