char[] ported from C to char[0] in the D core library

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 9 12:37:52 PDT 2015


On Wednesday, 9 September 2015 at 16:49:39 UTC, badlink wrote:
> The struct core.sys.linux.sys.inotify.inotify_event contains 
> the field "char[0] name" which corresponds to "char name[]" in 
> C.
>
> Why it has been translated to "char[0]" ?
> For me "char*" would have been more appropriate.

It's a flexible array member [1], not a pointer. Changing it to 
`char*` would make it incompatible with the C functions using it.

[1]: https://en.wikipedia.org/wiki/Flexible_array_member


More information about the Digitalmars-d-learn mailing list