Article View: gnu.gcc.help
Article #50952problem with parameter defined structure.
From: Marc E. Fiuczynski
Date: Thu, 15 Jul 1993 01:09
Date: Thu, 15 Jul 1993 01:09
38 lines
1709 bytes
1709 bytes
In the BSDI kernel there are many parameter defined structures. With
gcc v1 the following function will compile and "work".
mytest(parameter_struct_variable)
register struct args {
char a;
int b;
} *parameter_struct_variable;
{
struct args {
char a;
int c;
} local_struct_variable;
local_struct_variable.a = parameter_struct_variable->a; /* OK */
local_struct_variable.c = parameter_struct_variable->b; /* BAD */
}
version 2 of gcc produces:
/usr/local/bin/gcc -c foo.c
foo.c: In function `mytest':
foo.c:5: warning: structure defined inside parms
foo.c:7: redefinition of `struct args'
foo.c:13: structure has no member named `b'
where vesion 1 of gcc does not care about this. Could someone please
let us know why this functionality of gcc has changed from version 1
and version 2.
(Personally, I think that version 2 does the correct thing with
redefining the structure, since parameters and local variables
really should be at the same scope.)
Sincerley,
Marc E. Fiuczynski
The MITRE Corporation
Technical Details
Message-ID:
<9307141941.AA00245@radon.ie.org>Path:
arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!doc.ic.ac.uk!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!radon.IE.ORG!mefShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,4a94dc0ee5e1b654,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-07-14 18:24:38 PST Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!doc.ic.ac.uk!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!radon.IE.ORG!mef From: mef@radon.IE.ORG (Marc E. Fiuczynski) Newsgroups: gnu.gcc.help Subject: problem with parameter defined structure. Date: 14 Jul 1993 21:09:44 -0400 Organization: GNUs Not Usenet Lines: 39 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <9307141941.AA00245@radon.ie.org>