From owner-freebsd-hackers Fri Jun 8 6: 4:25 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 8C7BE37B406 for ; Fri, 8 Jun 2001 06:04:19 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 8146 invoked by uid 1000); 8 Jun 2001 13:03:04 -0000 Date: Fri, 8 Jun 2001 16:03:04 +0300 From: Peter Pentchev To: Assar Westerlund Cc: Thomas David Rivers , jhb@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: free() and const warnings Message-ID: <20010608160304.G7671@ringworld.oblivion.bg> Mail-Followup-To: Assar Westerlund , Thomas David Rivers , jhb@FreeBSD.ORG, hackers@FreeBSD.ORG References: <20010608114957.C19938@ringworld.oblivion.bg> <200106081055.GAA49069@lakes.dignus.com> <20010608154249.A7671@ringworld.oblivion.bg> <5ld78frunz.fsf@assaris.sics.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <5ld78frunz.fsf@assaris.sics.se>; from assar@FreeBSD.ORG on Fri, Jun 08, 2001 at 03:02:56PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Jun 08, 2001 at 03:02:56PM +0200, Assar Westerlund wrote: > Peter Pentchev writes: > > GCC complains when I try to initialize the structure with something like: > > > > struct validation_fun val_init[] = { > > {"init", valfun_init, 0} > > }; > > > > This can be avoided by: > > > > struct validation_fun val_init[] = { > > {(char *) (uintptr_t) "init", valfun_init, 0} > > }; > > > > ..but as a matter of fact, static, pre-initialized valfun structs are > > the rule rather than the exception in this program, so having this > > syntax for all of them seems.. well.. ugly :) > > What version of gcc is this? 2.96? > > All versions of 2.95.x that I've tried seems to eat the following > program with: > > gcc -O -g -Werror -Wcast-qual -c foo.c > > /assar > > struct validation_fun { > const char *name; > void *fun; > int dyn; > }; > > struct validation_fun val_init[] = { > {"init", 0, 0} > }; My explanation was a reply to a suggestion to remove the 'const' in the structure definition. G'luck, Peter -- If I had finished this sentence, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message