importc and stb

Patrick Schluter Patrick.Schluter at bbox.fr
Fri Dec 17 09:30:54 UTC 2021


On Thursday, 16 December 2021 at 19:04:21 UTC, bachmeier wrote:
> 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.

You're not serious, aren't you? Except for the typecast syntax 
the expression is also valid D.



More information about the Digitalmars-d mailing list