Re: [AD] Proposal: removal of zero-sized arrays |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Laurence Withers wrote:
As the title says, I propose that we remove zero-sized arrays from the
library.
I support you fully, given that it is practical to implement: see later...
Advantages:
[snip]
Also much more flexible: any add-on (or other user code) that needs it
can plug his own char** array into the BITMAP structure without having
to malloc and initialize a new copy of the line[][] array.
I see no technical advantage of the zero-size arrays.
Disadvantages:
[snip]
- increases instance size by sizeof(void*) + alignment
- functions creating such structures require an extra line of code
These are nothing to worry about, IMHO.
What stays the same:
Probably tons of asm code needs to be rewritten. With zero-sized arrays
it is:
line_ptr = bmp_ptr + static_offset
Without zero-sized arrays it will be
line_ptr = *(bmp_ptr + static_offset)
Sven