home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,181 of 243,242   
   Philipp Klaus Krause to All   
   Re: What is the meaning of array paramet   
   27 Nov 25 10:34:37   
   
   From: pkk@spth.de   
      
   Looking at clang and gcc diagnostics:   
      
   // Tested via gcc/clang -Wall -pedantic -Warray-parameter -Warray-bounds   
   test.c   
      
   void f(char a[4])   
   {   
   	a[4] = 7; // clang doesn't warn. gcc warns with -O2/-O3 only   
   }   
      
   void g(void)   
   {   
   	char a[3];   
   	f(a); // gcc warns, clang doesn't.   
   	f(0); // neither gcc nor clang warn   
   }   
      
   So apparently passing a null pointer is considered less bad by gcc than   
   passing an array shorter than declared. And clang doesn't care about   
   anything here.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca