Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: srand(0) Date: Tue, 30 Dec 2025 19:37:25 -0800 Organization: None to speak of Lines: 31 Message-ID: <87fr8rwccq.fsf@example.invalid> References: <10ib0ka$3cgil$1@dont-email.me> <10icocl$3u4ua$1@dont-email.me> <10idg5m$3k87$3@dont-email.me> <20251224105114.0000714b@yahoo.com> <10ih0qo$13hnn$2@dont-email.me> <20251224174452.00003278@yahoo.com> <10ih3lu$13hnn$5@dont-email.me> <10ih5r2$25ihh$5@dont-email.me> <10iiell$1kfhj$1@dont-email.me> <10iirh8$25ihh$6@dont-email.me> <10ilfqp$2fs21$1@dont-email.me> <10ivq6b$1j8r3$1@dont-email.me> <10j206j$27s3j$1@dont-email.me> <10j247s$2925s$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 31 Dec 2025 03:37:26 +0000 (UTC) Injection-Info: dont-email.me; posting-host="eea1bd566f7c70dcb85fabb9ef2f06cf"; logging-data="2415548"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195OLDaP17YQwwRRrw0woKn" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:DaxuIFikY86nuzSIrsAlxTyHVm0= sha1:o7XNRqRi8Brcq49R9S84pis3Ykg= Xref: csiph.com comp.lang.c:396024 Lawrence D’Oliveiro writes: > On Wed, 31 Dec 2025 02:01:55 -0000 (UTC), Michael Sanders wrote: >> *ISO C (C17 / C23)*: >> >> C17, 5.1.2.2.1 "Program startup" >> >> The value of argc shall be nonnegative. >> >> argv[argc] shall be a null pointer. >> >> If the value of argc is greater than zero, the array members argv[0] >> through argv[argc−1] inclusive shall contain pointers to strings >> which are given implementation-defined values. >> >> ... >> >> What say you? > > Clearly on Windows, there are no guarantees about argc contains, so > you shouldn’t be relying on it. That's not clear. Linux (since 2022) guarantees argc>=1. I don't know whether Windows makes a similar guarantee, but it's entirely plausible that it could. But not all systems guarantee argc>=1, so any portable code shouldn't make assumptions beyond what's guaranteed by ISO C. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */