[PATCH] Convert the C code to using stdbool and true/false

Thiago Macieira thiago at macieira.org
Wed Jan 15 12:25:00 UTC 2014


On quarta-feira, 15 de janeiro de 2014 19:54:41, Anton Lundin wrote:
>  #ifdef __cplusplus
>  extern "C" {
> -#else
> -#if __STDC_VERSION__ >= 199901L
> -#include <stdbool.h>
> -#ifndef TRUE
> -#define TRUE true
> -#endif
> -#ifndef FALSE
> -#define FALSE false
> -#endif
> -#else
> -typedef int bool;
> -#ifndef TRUE
> -#define TRUE 1
> -#endif
> -#ifndef FALSE
> -#define FALSE 0
> -#endif
> -#endif
>  #endif
> +#include <stdbool.h>

Strictly speaking, we shouldn't include stdbool.h in C++ code.

So this should be:

#ifdef __cplusplus
extern "C"
#else
#include <stdbool.h>
#endif

However, both GCC and Clang allow for it, so I don't see a problem.

MSVC 2012 doesn't have it, but 2013 does -- Microsoft finally added some C99 
features.

-- 
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/f75b4d80/attachment.sig>


More information about the subsurface mailing list