Article View: gnu.g++.bug
Article #817Re: Gnu C++ bugs in classes
From: Mike Stump
Date: Sat, 29 Aug 1992 13:09
Date: Sat, 29 Aug 1992 13:09
48 lines
1788 bytes
1788 bytes
This is not a bug. Please read an up-to-date book on C++.
int mousecatcher::mice; at top level cures your broken code.
> Message-Id: <MAILQUEUE-101.920819095700.744@fs1.metallurgy.umist.ac.uk>
> From: A.APPLEYARD@fs1.mt.umist.ac.uk
> Date: 19 Aug 92 09:57:00 GMT
> BUG REPORT: In Gnu C version 2.0, static members of classes are not allocated
> storage space, and thus the linker complains that these symbols are missing if
> I use them.
> This bug was not present in the last version of Gnu C which I had (1.39?).
> Herewith a C++ program, and its translation into assembler by Gnu C++.
> Notice that there is no assembler line 'comm __12mousecatcher$mice,4'.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> class mousecatcher{public:
> int cat,ferret,owl,trap;
> static int mice;};
> int i,j,k; mousecatcher Tom;
> main(){i=Tom.cat; j=Tom.ferret; k=Tom.mice;}
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> .file "t$$.cc"
> gcc2_compiled.:
> .text
> .align 2
> .globl _main
> _main:
> pushl %ebp
> movl %esp,%ebp
> call ___main
> movl _Tom,%edx
> movl %edx,_i
> movl _Tom+4,%edx
> movl %edx,_j
> movl __12mousecatcher$mice,%edx
> movl %edx,_k
> xorl %eax,%eax
> jmp L1
> .align 2,0x90
> jmp L1
> .align 2,0x90
> L1:
> leave
> ret
> .comm _i,4
> .comm _j,4
> .comm _k,4
> .comm _Tom,16
Technical Details
Message-ID:
<9208291309.AA28681@cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrsShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs From: mrs@cygnus.com (Mike Stump) Subject: Re: Gnu C++ bugs in classes Message-ID: <9208291309.AA28681@cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 29 Aug 1992 13:09:59 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 51