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 16:05:19 -0800 Organization: None to speak of Lines: 23 Message-ID: <87h5t6uri8.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> <87fr8rwccq.fsf@example.invalid> <10j3mit$2o18r$1@dont-email.me> <87pl7uut6c.fsf@example.invalid> <10j4bok$2vboo$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 01 Jan 2026 00:05:20 +0000 (UTC) Injection-Info: dont-email.me; posting-host="33b043e89e5f39dc06c7cc358565192e"; logging-data="3106480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fQoEMchhbOCNBnASgq3FC" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:I5EfE3PiIeUpU+vpenBRYyUl8TE= sha1:lYn6xKs5ll4e2WaCXB7Ydw1cpI0= Xref: csiph.com comp.lang.c:396049 highcrew writes: > On 1/1/26 12:29 AM, Keith Thompson wrote: >> Paul writes: >> That isn't quite correct, or is at least misleading. ISO C guarantees >> that argv[0] exists, but not that it points to a string. On some >> systems, it can contain be a null pointer. > > I heard of this before. > > Is it just theoretical, or do we have actual systems where > argv[0]==NULL? I never saw it happen in any modern operating system. Some systems (try to) guarantee that argv[0] points to a string, which may or may not be the name of the program. But there are ways, on some systems, to invoke a program with argc==0 and argv[0]==NULL. For details see here (I've recently made some updates). https://github.com/Keith-S-Thompson/argv0 -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */