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: Wed, 31 Dec 2025 15:14:27 -0800 Organization: None to speak of Lines: 33 Message-ID: <87y0miutv0.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> <20251231152909.00002bf9@yahoo.com> <10j42fb$2s72e$5@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 31 Dec 2025 23:14:28 +0000 (UTC) Injection-Info: dont-email.me; posting-host="eea1bd566f7c70dcb85fabb9ef2f06cf"; logging-data="3106480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+P0bAOHOwEY4kRgZ7o97LS" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:I7CJKpXhMqYq+AnMYYSot5gDUJk= sha1:C0Vc2M3TCA4Ead5w7PEii9B/nXk= Xref: csiph.com comp.lang.c:396042 Lawrence D’Oliveiro writes: > On Wed, 31 Dec 2025 15:29:09 +0200, Michael S wrote: >> On Wed, 31 Dec 2025 03:10:52 -0000 (UTC) >> Lawrence D’Oliveiro wrote: >>> Clearly on Windows, there are no guarantees about argc contains, so >>> you shouldn’t be relying on it. >> >> How did you come to this conclusion? > > The fact that the C spec says so. You may well be correct, but I don't know how you reached that conclusion. Older Linux kernels make it possible to invoke a program with argc==0 and argv[0]==NULL. Newer Linux kernels have a modified execve() that guarantees argc==1 and argv[0]!=NULL. NetBSD still permits argc==0. So some Unix-like systems (try to) guarantee argc>0, and some do not. It's entirely possible that Windows goes beyond the ISO C requirements and explicitly or implicitly guarantees argc>0. It's also entirely possible that it doesn't. Do you have any concrete information one way or the other > Is there any standard on Windows for > how different C compilers are supposed to handle argc/argv? That's a good question, and I don't know the answer. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */