home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16805 < prev    next >
Encoding:
Text File  |  1992-11-24  |  1.3 KB  |  36 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: Nested Templates in g++
  5. Message-ID: <1992Nov23.233331.5003@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1992Nov23.045517.10090@pasteur.Berkeley.EDU> <1992Nov23.061246.113768@watson.ibm.com>
  8. Date: Mon, 23 Nov 1992 23:33:31 GMT
  9. Lines: 25
  10.  
  11. magerman@watson.ibm.com (David Magerman;046923) writes:
  12.  
  13.  
  14. >Using the xlC++ 1.1.1, trying to
  15. >refer to B<A<X,Y>> generates a syntax error, because the compiler
  16. >tries to interpret the >> as an operator.  If I use B<A<X,Y> >, it
  17. >compiles and runs fine.
  18.  
  19. >However, since you're using g++, this might be irrelevant.  (Could two
  20. >independently written compilers have the same stupid error?)
  21.  
  22. This is not a compiler error, but the way the language is defined.
  23.  
  24. In the initial phases of translation of the C++ source program, the
  25. source is broken up into tokens.  A token is the longest sequence
  26. of characters which could be a token.
  27.  
  28. In the example above, the sequence ">>" is taken to be the single token
  29. ">>" and never as the two tokens "> >", no matter what the context.
  30.  
  31. This concept is not new in C or C++, and appears in K&R1.
  32. -- 
  33.  
  34. Steve Clamage, TauMetric Corp, steve@taumet.com
  35. Vice Chair, ANSI C++ Committee, X3J16
  36.