Re: [PATCH] [kernel/ subdirectory] constifications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2006-10-09 at 20:16 +0200, Helge Deller wrote:
> On Monday 09 October 2006 08:59, Arjan van de Ven wrote:
> > On Sun, 2006-10-08 at 21:21 +0200, Helge Deller wrote:
> > > - completely constify string arrays,  thus move them to the rodata section
> > 
> > note that gcc 4.1 and later will do this automatically for static things
> > at least...
> 
> Are you sure ?
> 
> At least with gcc-4.1.0 from SUSE 10.1 the strings array _pointers_ are not moved into the rodata section without the second "const":
> const static char * const x[] = { "value1", "value2" };
> 

hmm I could have sworn GCC does this automatic nowadays as long as it
can prove you're not writing to the thing (eg static and not passing the
pointer to some external function).....

(even if gcc does this perfect I'm still in favor of the explicit const,
just to catch stupid code with a warning)

-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux