home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / g / bug / 2114 < prev    next >
Encoding:
Text File  |  1993-01-03  |  2.5 KB  |  89 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!idiap.CH!tmb
  3. From: tmb@idiap.CH (Thomas M. Breuel)
  4. Subject: mailer/gateway problem
  5. Message-ID: <9301031100.AA16265@idiap.ch>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: tmb@idiap.ch
  8. Organization: GNUs Not Usenet
  9. Distribution: gnu
  10. Date: Sun, 3 Jan 1993 13:00:40 GMT
  11. Approved: bug-g++@prep.ai.mit.edu
  12. Lines: 75
  13.  
  14. I sent the letter reproduced below to "bug-g++@ai.mit.edu". First, it
  15. got gatewayed to "gnu.g++.help" and "comp.lang.c++".  That is not what
  16. I wanted. It definitely shouldn't have ended up in either of these
  17. newsgroups. I also don't think it is a good idea to gateway _any_ g++
  18. related traffic to "comp.lang.c++".
  19.  
  20. Please check your mail aliases, and please forward the message to
  21. the appropriate mailing list.
  22.  
  23.                 Thanks,
  24.                     Thomas.
  25.  
  26.  
  27. To: bug-g++@ai.mit.edu
  28. Subject: gcc (C++) 2.3.2 generates bad assembly language output (redefined symbol)
  29.  
  30.  
  31. gcc -v -c foo.cc
  32. Reading specs from /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/specs
  33. gcc version 2.3.2
  34.  /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
  35. GNU CPP version 2.3.2 (sparc)
  36.  /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
  37. GNU C++ version 2.3.2 (sparc) compiled by GNU C version 2.3.2.
  38.  as -o foo.o /local/tmp/cca11717.s
  39. as: "/local/tmp/cca11717.s", line 96: error: redefinition of symbol "_lookup"
  40. gcc: foo.o: No such file or directory
  41.  
  42. == foo.cc ======================================================
  43. #include <std.h>
  44.  
  45. template <class Y>
  46. struct NameValuePair {
  47.     char *name;
  48.     Y y;
  49. };
  50.  
  51. template <class Y>
  52. inline Y lookup(NameValuePair<Y> *data,char *name) {
  53.     while(data->name) {
  54.         if(!strcmp(data->name,name)) return data->y;
  55.         data++;
  56.     }
  57.     abort();
  58.     return data->y;        // to keep GCC happy
  59. }
  60.  
  61. template <class T>
  62. void swap(T &x,T &y) {
  63.     T temp = x;
  64.     x = y;
  65.     y = temp;
  66. }
  67.  
  68. typedef char (*canonicalizer)(char &,float *);
  69.  
  70. NameValuePair<canonicalizer> canonicalizers[] = {
  71.     {0,0}
  72. };
  73.  
  74. typedef float (*extractor)(float &image,float g=2.0);
  75.  
  76. NameValuePair<extractor> extractors[] = {
  77.     {0,0}
  78. };
  79.  
  80. void foo() {
  81.     canonicalizer canonicalize = lookup(canonicalizers,(char*)"foo");
  82.     extractor extract = lookup(extractors,(char*)"bar");
  83. }
  84.  
  85. ================================================================
  86.  
  87.  
  88.  
  89.