Sujet : Re: Regarding assignment to struct
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 06. May 2025, 14:34:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250506163456.000053a1@yahoo.com>
References : 1 2 3 4
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Mon, 05 May 2025 13:53:10 -0700
Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
Muttley@dastardlyhq.com writes:
[...]
If you twant o pass an actual array to a function instead of a
pointer to it, embedding it in a structure is the only way to do
it.
Yes, but that's not necessarily useful. An array that's a member
of a struct can only be of a constant length (unless it's a flexible
array member, but that doesn't help). Functions that work with
arrays typically need to deal with arrays of arbitrary length.
It seems, C++ authorities were feeling that the pattern "struct with
array of constant length as an only member" is very common.
Otherwise they wouldn't bother to add <array> to their standard library.