ImportC rocks!

Andrea Fontana nospam at example.com
Mon Mar 14 16:26:13 UTC 2022


On Monday, 14 March 2022 at 13:30:44 UTC, Steven Schveighoffer 
wrote:
> Yes, C does not allow manifest constants of anything other than 
> integers via enum. Raylib has eschewed most (all?) #defines of 
> integers, preferring enums, but e.g. a `Color` struct cannot be 
> an enum.
>
> The pain of having to not only redeclare manifest constants but 
> *also* give them a different name is pretty high.
>
> -Steve

I can't belive compiler can't handle a simple optimization for a 
non-manifest color const.

Is really a performance penalty to declare BLACK like this?
```c
const struct Color BLACK = (Color){0,0,0,255
```



More information about the Digitalmars-d mailing list