ImportC has improved macro support

Ki Rill rill.ki at yahoo.com
Fri Dec 8 05:17:30 UTC 2023


On Wednesday, 6 December 2023 at 19:59:54 UTC, Walter Bright 
wrote:
> Macros with the pattern:
>
>     #define BOO ( expression )
>
> are now translated to:
>
>     auto BOO()() { return expression; }
>
> and are available for importing!

This is amazing! It should solve the disappearing of enum-like 
definitions in code. I encountered this in Raylib. It has colors 
defined as macros:

```c
#define WHITE (Color){255, 255, 255, 255}
```

I preprocessed the file and all color definitions were gone. I 
had to redefine them manually.

Nuklear does the same too for their Flags.


More information about the Digitalmars-d-announce mailing list