[HarfBuzz] Use of bool and stdbool.h

Behdad Esfahbod behdad at behdad.org
Fri Aug 9 18:10:33 UTC 2019


On Fri, Aug 9, 2019 at 10:33 AM Ebrahim Byagowi <ebraminio at gmail.com> wrote:

> Was looking inside libraqm code and saw the use of stdbool.h there, made
> we wonder why HarfBuzz went for hb_bool_t and whether we can go for it also
> or not.
>

Because back in 2006 even stdint.h was not portable-enough.  You still see
the following block in hb-common.h:

 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
    defined (_sgi) || defined (__sun) || defined (sun) || \
    defined (__digital__) || defined (__HP_cc)
#  include <inttypes.h>
#elif defined (_AIX)
#  include <sys/inttypes.h>
#elif defined (_MSC_VER) && _MSC_VER < 1600
/* VS 2010 (_MSC_VER 1600) has stdint.h */
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#  include <stdint.h>
#endif


> If a migration isn't possible, most likely I'd guess, maybe having some
> compiler definition for using actual bool instead 'int', at least for
> clients that are embedding harfbuzz can trig some optimizations for them.
>

I don't think it makes any optimizations possible per se.  I'd just forget
it...

We should review if we take any hb_bool_t* arguments in any API.  If not,
it's probably safe ABI-wise to change.


>
> Thanks!
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/harfbuzz



-- 
behdad
http://behdad.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20190809/bfe6c881/attachment.html>


More information about the HarfBuzz mailing list