Sujet : Re: Struct Error
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 24. Jan 2025, 01:37:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vmunc7$1snhv$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 23/01/2025 23:50, Lawrence D'Oliveiro wrote:
On Thu, 23 Jan 2025 10:54:10 +0000, bart wrote:
Wouldn't this also be the case here:
>
struct scenet *child;
};
>
The struct is incomplete, but it still knows how to do pointer
arithmetic with that member.
No, because there is no pointer arithmetic involved in processing that
declaration.
Neither of these member declarations involve any expression:
....
struct scenet *childp;
struct scenet (*childa)[];
};
Yet childp is fine, but childa is a gcc compiler error. Why is that?
When expressions are used later on, both need to know the size of struct, which has been determined by then.