Re: ImportC has improved macro support

2023-12-07 Thread Ki Rill via Digitalmars-d-announce
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.


Re: ImportC has improved macro support

2023-12-07 Thread Walter Bright via Digitalmars-d-announce

On 12/6/2023 12:43 PM, Dave P. wrote:

Does this work for function-like macros?


Not yet. It just lays the groundwork for that.