Date: 08 Jun 2001 15:02:56 +0200 From: Assar Westerlund <assar@FreeBSD.ORG> To: Peter Pentchev <roam@orbitel.bg> Cc: Thomas David Rivers <rivers@dignus.com>, jhb@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: free() and const warnings Message-ID: <5ld78frunz.fsf@assaris.sics.se> In-Reply-To: Peter Pentchev's message of "Fri, 8 Jun 2001 15:42:49 %2B0300" References: <20010608114957.C19938@ringworld.oblivion.bg> <200106081055.GAA49069@lakes.dignus.com> <20010608154249.A7671@ringworld.oblivion.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
Peter Pentchev <roam@orbitel.bg> 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}
};
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5ld78frunz.fsf>
