From: Keith.S.Thompson+u@gmail.com   
      
   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 */   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|