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:00:24 -0800 Organization: None to speak of Lines: 29 Message-ID: <877bu2w92v.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> <87jyy3wcgf.fsf@example.invalid> <20251231151502.00002c3e@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 31 Dec 2025 23:00:25 +0000 (UTC) Injection-Info: dont-email.me; posting-host="eea1bd566f7c70dcb85fabb9ef2f06cf"; logging-data="3106480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/PBTMoqUugN1hqD9mUIwLK" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:YGLfLvZwTkKWZ2UbyjqMusa8IAc= sha1:N1DedG8RhK0aGBMPblwgUoAJG5I= Xref: csiph.com comp.lang.c:396038 Michael S writes: > On Tue, 30 Dec 2025 19:35:12 -0800 > Keith Thompson wrote: [...] >> For more information, see >> . > > If you are interested in behavior on non-POSIX systems, primarily > Windows, but possibly others as well (e.g. VMS) then using exec() in > caller sounds like a bad idea. It just not how these systems work and > not how people write programs on them. > Even when exec() *appears* to works in some environments (like > msys2) it likely emulated by spawn() followed by exit(). > > I'd implement caller with spawn(). I suppose that even on POSIX it is > more idiomatic. If I were going to look into the behavior on Windows, I'd probably want to use Windows native features. (I tried my test on Cygwin, and the callee wasn't invoked.) Apparently the Windows way to invoke a program is CreateProcessA(). But it takes the command line as a single string. There might not be a Windows-native way to exercise the kind of control over argc and argv provided by POSIX execve(). -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */