Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: variable addresses on the stack Date: Wed, 21 Sep 2022 15:30:11 -0700 Organization: None to speak of Lines: 27 Message-ID: <878rmcfjik.fsf@nosuchdomain.example.com> References: <54f99ed2-fe4d-4cab-944c-cb61799d64ecn@googlegroups.com> <871qtc868m.fsf@nosuchdomain.example.com> <50c4530a-b411-4ceb-8b8c-2181a15afd8fn@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="b6dd3111f3087e08fb468b174c9193d6"; logging-data="2031421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yqBC7xTcsEbDHkLrgrva1" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:hSXetbMl2qbAWAR2zcube3l/m4k= sha1:Ex3aVY7VjLscwS01pMwVN1W1KZ0= Xref: csiph.com comp.lang.c:167779 Thiago Adams writes: [...] > C99 added Flexible array members > > struct s { > int n; > double d[]; > }; > > Does anyone have suggestion how to write this in C89? > > struct s { > int n; > double d[1]; //maybe? > }; > > The sizeof a struct with flexible array members is not not clear.. The (questionably legal) predecessor to flexible array members was known as the "struct hack". See question 2.6 of the comp.lang.c FAQ. https://www.c-faq.com/ -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */