ImportC rocks!
Steven Schveighoffer
schveiguy at gmail.com
Mon Mar 14 17:49:23 UTC 2022
On 3/14/22 12:26 PM, Andrea Fontana wrote:
> 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.
>>
>
> 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
> ```
>
You can submit your request to raylib, and see if they accept it. I
doubt it.
One thing that is very obvious from a few of my PRs is that raylib is
not interested in making changes specifically to be binding-friendly. I
think you will probably find this from many C libraries -- their focus
is their library, not yours. If ImportC cannot work with C libraries as
they stand without "simple tweaks", then it's just not going to be worth
much.
-Steve
More information about the Digitalmars-d
mailing list