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]" ?

In that structure, the name is appended directly to the end of the data instead of pointed to. The size isn't known at compile time, so a zero-length placeholder is there instead.

You'd access it by using the .ptr property and get the length out of the `len` field.

For me "char*" would have been more appropriate.

That's typically right, but since this case does it in-place instead of pointed, the zero length array is most accurate.

Reply via email to