From owner-freebsd-hackers Wed Nov 22 02:06:18 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id CAA23658 for hackers-outgoing; Wed, 22 Nov 1995 02:06:18 -0800 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id CAA23639 for ; Wed, 22 Nov 1995 02:06:08 -0800 Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id LAA20596; Wed, 22 Nov 1995 11:02:34 +0100 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id LAA27220; Wed, 22 Nov 1995 11:02:34 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.6.12/8.6.9) id KAA21334; Wed, 22 Nov 1995 10:07:30 +0100 From: J Wunsch Message-Id: <199511220907.KAA21334@uriah.heep.sax.de> Subject: Re: HELP with typedef To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Wed, 22 Nov 1995 10:07:29 +0100 (MET) Cc: Jerry.Kendall@vmicls.com Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199511211745.KAA25161@rocky.sri.MT.net> from "Nate Williams" at Nov 21, 95 10:45:03 am X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 666 Sender: owner-hackers@freebsd.org Precedence: bulk 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. ;-)