[PATCH 11/13] Convert to TRUE/FALSE to stdbools true/false
Thiago Macieira
thiago at macieira.org
Wed Jan 15 09:39:49 UTC 2014
On quarta-feira, 15 de janeiro de 2014 19:25:45, Dirk Hohndel wrote:
> On Wed, 2014-01-15 at 13:59 +0200, Lubomir I. Ivanov wrote:
> > On 15 January 2014 10:30, Anton Lundin <glance at acc.umu.se> wrote:
> > > I had problems with this one on Qt5.
> >
> > this seems like a big change. could you elaborate why it was needed
> > exactly? i think it would be preferable that we don't use stdbool for
> > consistency with the C code.
> > for example, things like process_dives() are C backend calls.
>
> I'll let Thiago speak on this with more authority, but it was my
> understanding that true/false and TRUE/FALSE are intended to be
> compatible...
Qt 4's qglobal.h defined TRUE and FALSE:
# ifndef TRUE
# define TRUE true
# define FALSE false
# endif
Qt 5 does no such thing, they were removed in
https://qt.gitorious.org/qt/qtbase/commit/158f39ec7870c54ff3a15f72fe151062d6daa172
Those macros had existed since Qt 1, from before the C++ standardisation, when
some compilers did not have an actual bool type. We thought that they weren't
needed in 2012 for C++ code.
For Subsurface's C code, as long as we include C99's <stdbool.h>, we're fine.
It does this in C mode:
#define bool _Bool
#define true 1
#define false 0
So for Subsurface code: use bool, true, false (all lowercase).
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140115/0d832901/attachment.sig>
More information about the subsurface
mailing list