From owner-freebsd-questions@FreeBSD.ORG Tue Oct 28 12:04:02 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8118D1065682 for ; Tue, 28 Oct 2008 12:04:02 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 3E90F8FC12 for ; Tue, 28 Oct 2008 12:04:01 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KunIm-0007VX-Bb for freebsd-questions@freebsd.org; Tue, 28 Oct 2008 12:04:00 +0000 Received: from 77.22.123.51 ([77.22.123.51]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Oct 2008 12:04:00 +0000 Received: from ino-news by 77.22.123.51 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Oct 2008 12:04:00 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: clemens fischer Date: Tue, 28 Oct 2008 13:03:32 +0100 Lines: 24 Message-ID: References: <20081027200749.GB29814@icarus.home.lan> <20081027202219.GE2435@spotteswoode.de.eu.org> <20081028105715.GA33501@stack.nl> X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 77.22.123.51 X-Archive: encrypt=none User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/8.0-CURRENT (i386)) Sender: news Subject: Re: reviving games/freebsd-games X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2008 12:04:02 -0000 On Tue, 28 Oct 2008 11:57:15 +0100 Jurjen Middendorp wrote: > If you do char *p = "something", you can't write to that string (it's > a pointer into some stringtable: easy way to look at it :). You have > to use char p[] = "something", then it's an array with enough storage > to write to :) maybe try something like char scrollname[NUMSCROLLS][]; ? Thank you and Martin for your very helpful comments! You have a point there: the compiler might put the strings themselves into a read-only table and keep only the pointers to them, as declared. I didn't think of that. Do you happen to know what linker section gcc-4.x puts strings into? I thought I'd clean up that code declaring a real struct like: struct scrollname_s { int active; char name[] = "..."; }; then name could stay read-only. OTOH I found numerous larn versions, so keeping ours "compatible" might keep maintenance costs down. -c