Date: Thu, 26 May 2005 00:48:24 -0400 From: Craig Rodrigues <rodrigc@crodrigues.org> To: "Andrew R. Reiter" <arr@watson.org> Cc: freebsd-current@freebsd.org Subject: Re: [GCC 4.0 PATCH] devfs_vnops.c Message-ID: <20050526044824.GA81201@crodrigues.org> In-Reply-To: <20050525234400.H5498@fledge.watson.org> References: <20050526020143.GA80396@crodrigues.org> <20050525234400.H5498@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 25, 2005 at 11:44:52PM -0400, Andrew R. Reiter wrote: > Is this a GCC-ism or a standards related issue that 4.0 now addresses? This is a standards issue that GCC 4.0 addresses, which GCC 3.4.2 did not (newer versions of the GCC 3.4.x tree might address is but I haven't checked). In 6.2.2 paragraph 7 of the ISO C standard, "If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined." So, if you have: extern struct foo bar; static struct foo bar = { ..... }; This is illegal. When the compiler hits the first line, there was no previous declaration of "struct foo bar", so the linkage of "struct foo bar" defaults to external linkage. However, the next line declares "struct foo bar" to have internal linkage. -- Craig Rodrigues rodrigc@crodrigues.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050526044824.GA81201>