Liste des Groupes | Revenir à cl c |
Michael S <already5chosen@yahoo.com> writes:
>On Tue, 19 Mar 2024 21:40:22 -0700>
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>Michael S <already5chosen@yahoo.com> writes:
...
>>Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
...
>>>>static _Bool change_it( UI w, UI h, Color [w][h], Point, Color,>
Color );
Besides, I don't think that use of VLA in library code is a
good idea. VLA is optional in latest C standards. And
incompatible with C++.
The code uses a variably modified type, not a variable length
array.
I am not sufficiently versed in C Standard terminology to see a
difference.
A VLA is a declared object -- an array with a size that is not a
compile-time constant. A variably modified type is just a type,
not an object. Obviously one can use such a type to declare a
VLA, but when it is the type of a function parameter, there need
be no declared object with that type. Usually the associated
function argument will have been dynamically allocated.
Aren't they both introduced in C99 and made optional in later>
standards?
I think so but that's a shame since VMTs are very helpful for
writing array code. They avoid the need to keep calculating the
index with multiplications.
Making both optional was a classic case of throwing the baby out
with the bath water. Few of the objections raised about VLAs
apply to VMTs.
Les messages affichés proviennent d'usenet.