3 ms·
Wouldn't the zero-length array potentially run into other memory?
by rhdoenges 15y ago
Wouldn't the zero-length array potentially run into other memory?
- notaddicted 15y agoIt is only fit to be used for heap allocation, you allocate the size that you need (i.e. malloc( sizeof(struct video_file2) + ARRAY_SIZE) ). It wouldn't work as a local variable. edit: I suppose one could use for globals or on the stack by casting a byte array ... I would find that to be unspeakably ugly but I don't write much C.
- rhdoenges 15y agoah, that's clever.
- munin 15y agozero-length arrays, FYI, are not a C thing, they are a GCC thing: http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html C99 has its own "zero sized array" thing but it is a different syntax.
- wollw 15y agoThat's why the usage changes to a struct pointer at that point. The struct pointer just maps parts of an existing data structure (like a video file) to its labels.