Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Two questions on arrays with size defined by variables Date: Mon, 10 Feb 2025 14:17:06 -0800 Organization: None to speak of Lines: 23 Message-ID: <87zfito36l.fsf@nosuchdomain.example.com> References: <878qqf1kl2.fsf@nosuchdomain.example.com> <877c5yr5vv.fsf@nosuchdomain.example.com> <878qqep9rx.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 10 Feb 2025 23:17:07 +0100 (CET) Injection-Info: dont-email.me; posting-host="f4acd3ba793eeb2facf0b27d62bf5cd0"; logging-data="1488123"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1ICBCFRWL6DSE3UZ4FINb" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:QhHKCHkdUwl5rRNNivjMFTu39u4= sha1:OrlhXze+kGB9YkTP9Bb1eWIlJ0s= Bytes: 2381 Janis Papanagnou writes: [...] > I haven't checked what's actually valid in current or former > "C" compilers or standards. As it's of minor relevance (to me) > I just see whether the compiler accepts my main() declaration > or not. (There was never a problem here, so why should I care.) That was probably meant to be a rhetorical question, but ... Because it might not always work in the future, when you port your code to another system, when a new release of the compiler you're using is installed, or during the next full moon. If your code has undefined behavior, it might appear to work perfectly until it doesn't. If your code is valid according to the C standard, you're less likely to run into problems -- and if a compiler rejects your code you have a good basis for a bug report. If "void main()" or "main()" starts behaving differently, or being rejected, you don't have much recourse. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */