metz@iam.unibe.ch (Igor Metz) (08/16/89)
I compiled the program below with g++ 1.35.1- on a Sun 3/60 (SunOS 3.5) and on a SparcStation 1 (SunOS 4.0.3), but I get different warnings! I probably made a mistake when installing g++. Could please somebody try to compile this code on her/his Sun-4 ? Thank you Igor Metz /================================ static const short MAX_ADR_LEN = 10; class Address { private: char adr[MAX_ADR_LEN]; short len; // current length of address public: Address() { len = -1; } // .... }; int foo (const Address& adr) { Address work = adr; return 0; } int main() { Address adr; return foo(adr); } /=================================== SUN 3/60: g++ -v -Wall gaga.cc g++ version 1.35.1- /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wall -D__HAVE_68881__ -Dmc68020 gaga.cc /tmp/cca07116.cpp GNU CPP version 1.35 /usr/local/lib/gcc-cc1plus /tmp/cca07116.cpp -quiet -dumpbase gaga.cc -Wall -noreg -version -o /tmp/cca07116.s GNU C++ version 1.35.1- (68k, MIT syntax) compiled by GNU C version 1.35. In function int foo (const struct Address &): gaga.cc:15: warning: bitwise copy in initialization of type `Address' gaga.cc:14: warning: statement with no effect gaga.cc:15: warning: unused variable `work' as -mc68020 /tmp/cca07116.s -o gaga.o /usr/local/lib/gcc-ld++ -C /usr/local/lib/crt0+.o /lib/Mcrt1.o gaga.o -lg++ /usr/local/lib/gcc-gnulib -lc SPARCSTATION 1: g++ -v -Wall gaga.cc g++ version 1.35.1- /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -Wall gaga.cc /tmp/cca02403.cpp GNU CPP version 1.35 /usr/local/lib/gcc-cc1plus /tmp/cca02403.cpp -quiet -dumpbase gaga.cc -Wall -noreg -version -o /tmp/cca02403.s GNU C++ version 1.35.1- (sparc) compiled by GNU C version 1.35. In function int foo (const struct Address &): gaga.cc:15: warning: unused variable `work' as /tmp/cca02403.s -o gaga.o /usr/local/lib/gcc-ld++ -C /usr/local/lib/crt0+.o gaga.o -lg++ /usr/local/lib/gcc-gnulib -lc