Am 04.01.2014 00:17 schrieb "Mark Morgan Lloyd" < markmll.fpc-pas...@telemetry.co.uk>: >>> >>> b5500centralcontrol.pas(119,18) Error: Incompatible types: got >>> "ShortInt" expected "ByteBool" > > >> > >> b5500centralcontrol.pas(119,18) Error: Incompatible types: got > >> "ShortInt" expected "ByteBool" > > > > You need to cast nevertheless. It's just that they can be used in > > place of e.g. BOOL parameters for WinAPI functions whereby the > > argument value is passed like the underlying non-Boolean datatype. > > Thanks Sven, noted and understood. In practice I've changed them all to qwords since this is the native size of the system being emulated, which leads to another question. If I have a field and property like > > fPB1L: qword; > .. > property PB1L: qword read: fPB1L write SetPB1L; > > procedure ...SetPB1L(p: qword); > begin > Assert((p = 0) or (p = 1)); > fPB1L := p > end; >
And why don't you use Boolean64? That's a 64 bit Boolean type with True being 1 and False being 0 (like the normal 1 Byte one). > is there an unobtrusive way of changing the property to effectively be > > property PB1L: qword read fPB1L write fPB1L; > > when assertions aren't being generated? The obvious way would be to use lots of $IFOPT C+ but is there anything more concise and maintainable? Can methods be inlined, and could the compiler successfully optimise-out a method which was a simple assignment? As long as you don't declare the getter/setter methods as "virtual", but as "inline" I *think* that it should work. Just test it and look at the generated assembler code (using -al option). If it works then then there should be no "call" instruction. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal