rjc@CS.UCLA.EDU (Robert Collins) (01/03/90)
I am on a Sun4/330, running SunOS 4.0.3. The problem is that when I declare a function to be const, it is made local, rather than global. Naturally, this precludes using it from another file, as the link fails. Am I declaring this incorrectly, or is this a bug, or both? Thanks, rob collins rjc@cs.ucla.edu Script started on Tue Jan 2 11:18:40 1990 regulus% cat a.cc extern const int foo(int); extern int bar(int); const int foo(int i) { return i; } int bar(int i) { return i; } regulus% g++ -v -O -S a.cc gcc version 1.36.1 (based on GCC 1.36) /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__OPTIMIZE__ a.cc /usr/tmp/cca05264.cpp GNU CPP version 1.36 /usr/local/lib/gcc-cc1plus /usr/tmp/cca05264.cpp -quiet -dumpbase a.cc -O -version -o a.s GNU C++ version 1.36.1 (based on GCC 1.36) (sparc) compiled by GNU C version 1.36. default target switches: -mfpu -mepilogue regulus% cat a.s gcc_compiled.: .text .align 4 .proc 1 _foo__Fi: !#PROLOGUE# 0 save %sp,-112,%sp !#PROLOGUE# 1 ret restore .align 4 .global _bar__Fi .proc 1 _bar__Fi: !#PROLOGUE# 0 save %sp,-112,%sp !#PROLOGUE# 1 ret restore regulus% ^D script done on Tue Jan 2 11:19:34 1990
tiemann@AI.MIT.EDU (Micheal Tiemann) (01/03/90)
It's a bug. I'll fix it. Michael