Re: ImportC has improved macro support

2023-12-09 Thread Paolo Invernizzi via Digitalmars-d-announce
On Friday, 8 December 2023 at 05:17:30 UTC, Ki Rill wrote: 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

Re: ImportC has improved macro support

2023-12-08 Thread Walter Bright via Digitalmars-d-announce
On 12/7/2023 9:17 PM, Ki Rill wrote: This is amazing! All in a day's work! 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

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

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.

Re: ImportC has improved macro support

2023-12-06 Thread Dave P. 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! Does this work for function-like macros?

Re: ImportC has improved macro support

2023-12-06 Thread user1234 via Digitalmars-d-announce
On Wednesday, 6 December 2023 at 20:26:38 UTC, Walter Bright wrote: The interesting thing here is `expression` does not need to be translated to D. It's still a C expression, and has C semantics. D templates with C semantics just falls out of the way ImportC was implemented. Indeed, I've

Re: ImportC has improved macro support

2023-12-06 Thread Walter Bright via Digitalmars-d-announce
On 12/6/2023 11:59 AM, Walter Bright wrote: Macros with the pattern:     #define BOO ( expression ) are now translated to:     auto BOO()() { return expression; } and are available for importing! The interesting thing here is `expression` does not need to be translated to D. It's still

ImportC has improved macro support

2023-12-06 Thread Walter Bright via Digitalmars-d-announce
Macros with the pattern: #define BOO ( expression ) are now translated to: auto BOO()() { return expression; } and are available for importing!