D as an extension language for C

IGotD- nise at nise.com
Tue May 16 11:04:53 UTC 2023


On Tuesday, 16 May 2023 at 07:48:42 UTC, Patrick Schluter wrote:
> On Monday, 15 May 2023 at 20:19:05 UTC, IGotD- wrote:
>>
>> What are the C features that cannot be expressed in D?
>
> VLA's and flexible arrays.

A C flexible array can be translated to a slice. I have done this 
myself and was amused how good fit it was. In 99% of the cases 
there is some upper limit for the flexible array and a slice is 
an extra guard against out of bounds accesses that C doesn't have.

VLA should be a part of the FFI and not importC.

The only thing I can think of that isn't supported are bitfields. 
The question is if this could have been solved with meta 
programming.


More information about the Digitalmars-d mailing list