Date: Wed, 22 Nov 1995 10:07:29 +0100 (MET) From: J Wunsch <j@uriah.heep.sax.de> To: freebsd-hackers@freebsd.org (FreeBSD hackers) Cc: Jerry.Kendall@vmicls.com Subject: Re: HELP with typedef Message-ID: <199511220907.KAA21334@uriah.heep.sax.de> In-Reply-To: <199511211745.KAA25161@rocky.sri.MT.net> from "Nate Williams" at Nov 21, 95 10:45:03 am
next in thread | previous in thread | raw e-mail | index | archive | help
As Nate Williams wrote: > typedef char *StringList[]; > > StringList List = {"one","two","three","four","END OF LIST",""}; > It now compiles with 'gcc -Wall', and works like I think you intend it > to do. But it wouldn't compile with -Wwrite-strings. :-) typedef const char *StringList[]; is better, since gcc places the strings in the read-only text segment by default, so they are actually constant strings. The additional warning option lets gcc warn about attempts to overwrite these strings. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511220907.KAA21334>