Thread View: gnu.g++.help
1 messages
1 total messages
Started by Thomas M. Breuel
Sat, 02 Jan 1993 20:48
gcc (C++) 2.3.2 generates bad assembly language output (redefined symbol)
Author: Thomas M. Breuel
Date: Sat, 02 Jan 1993 20:48
Date: Sat, 02 Jan 1993 20:48
55 lines
2099 bytes
2099 bytes
gcc -v -c foo.cc
Reading specs from /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/specs
gcc version 2.3.2
/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix foo.cc /local/tmp/cca11717.i
GNU CPP version 2.3.2 (sparc)
/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/cc1plus /local/tmp/cca11717.i -quiet -dumpbase foo.cc -version -o /local/tmp/cca11717.s
GNU C++ version 2.3.2 (sparc) compiled by GNU C version 2.3.2.
as -o foo.o /local/tmp/cca11717.s
as: "/local/tmp/cca11717.s", line 96: error: redefinition of symbol "_lookup"
gcc: foo.o: No such file or directory
== foo.cc ======================================================
#include <std.h>
template <class Y>
struct NameValuePair {
char *name;
Y y;
};
template <class Y>
inline Y lookup(NameValuePair<Y> *data,char *name) {
while(data->name) {
if(!strcmp(data->name,name)) return data->y;
data++;
}
abort();
return data->y; // to keep GCC happy
}
template <class T>
void swap(T &x,T &y) {
T temp = x;
x = y;
y = temp;
}
typedef char (*canonicalizer)(char &,float *);
NameValuePair<canonicalizer> canonicalizers[] = {
{0,0}
};
typedef float (*extractor)(float &image,float g=2.0);
NameValuePair<extractor> extractors[] = {
{0,0}
};
void foo() {
canonicalizer canonicalize = lookup(canonicalizers,(char*)"foo");
extractor extract = lookup(extractors,(char*)"bar");
}
================================================================
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads