Am 26.08.2017 09:50 schrieb "Michael Van Canneyt" <mich...@freepascal.org>: > > > > On Sat, 26 Aug 2017, Sven Barth via fpc-pascal wrote: > >> Am 26.08.2017 07:25 schrieb <nore...@z505.com>: >>> >>> >>> What about the BOOL issue.. >>> >>> We know that Boolean in fpc/delphi is not compatible with a C bool >>> >>> But it gets worse than that: even fpc/delphi's bool is not always >> >> compatible (but is sometimes). >>> >>> >>> For example: >>> http://blog.delphi-jedi.net/2008/09/25/bool-boolean-and-integer/ >>> >>> When one must use Integers to do boolean related programming tasks, it >> >> makes me want to quit programming ;) >>> >>> >> >> In FPC you can use the types Boolean16, Boolean32 and Boolean64 to get a >> type that behaves like Boolean, but has a different size. > > > Sorry for being naive. Why not simply use a boolean ? > > I thought all this BOOL mess was just meant to be able to interface with C > libs slightly easier. > > Instead of > > If (SomeCfunction()<>0) then > DoSomethingStupid; > > it allows you to write - in appropriate cases - the following: > > if (SomeCfunction()) then > DoSomethingStupid; > > I don't think we should promote BOOL and friends too much. They are a convenience (which IMHO should not have been introduced in the first place). > > Promoting them to first-class Pascal citizens is IMHO a bad idea.
Did you read the article that had been linked? That's an important point that is raised in there. These types as well as the Byte-, Word-, Long- and QWordBool types are mainly for interfacing with C-based interfaces, either on Windows or *nix and there they should definitely be used so that a Pascal user of them can simply use True and False and does not need to worry about the details (but of course the correct type needs to be used as the article shows). Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal