$ sudo apt install cdecl
[…]
$ cdecl
Type `help' or `?' for help
cdecl> explain char *(*(**foo[][8])())[];
declare foo as array of array 8 of pointer to pointer to function returning pointer to array of pointer to char
cdecl> $ sudo apt install cdecl
[…]
$ cdecl
Type `help' or `?' for help
cdecl> explain char *(*(**foo[][8])())[];
declare foo as array of array 8 of pointer to pointer to function returning pointer to array of pointer to char
cdecl> const foo: [_][8]**fn () [*][*:0]const u8;
This is an array of result-defined size, of arrays of eight pointers to fn pointers, which returns a many-item pointer to null-terminated arrays of u8. Null terminated because we're going to assume that the C data structure is properly null-terminated...Still an insane data structure, and I'm still learning Zig, so I can't promise this is precisely equivalent to the C, I got as close as I could and am unwilling to try and compile, let alone build, such a type.
No one would actually do this unless they needed `extern` compatibility. Ignoring the fact (pointed out in the Fine Article) that no one would use anything vaguely like this, a more Zig native version might be
const foo: [_][8]**fn() [][]const u8
Which returns a slice of slices of immutable u8s, these being fat pointers which include their length. seq[array[8, ptr ptr proc(): ptr seq[ptr char]]]]
I love having actual words instead of random punctuation soup.I believe dcl mimics the cdecl program.
char*[]*function()[8][] foo;