importc and stb

bachmeier no at spam.net
Thu Dec 16 19:04:21 UTC 2021


On Thursday, 16 December 2021 at 18:38:10 UTC, Elronnd wrote:
> On Thursday, 16 December 2021 at 14:26:42 UTC, bachmeier wrote:
>> https://github.com/ibuclaw/importC/blob/main/src/keywords.c.in
>
>> #define __builtin_bswap16(x) ((u_int16_t) ((((x) >> 8) & 0xff) 
>> | (((x) & 0xff) << 8)))
>
> Oh, my, that's bad.  GCC __builtins don't generally evaluate 
> more than once.  And this could just be an inline function 
> anyway.

This is why most of us should stay away from C. I honestly don't 
know what that incantation is doing, even though I've written a 
fair amount of C over the years.


More information about the Digitalmars-d mailing list