home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / gcc / help / 1806 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.4 KB  |  68 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!cs.utexas.edu!mercury.unt.edu!sol!kenc
  3. From: kenc@sol.acs.unt.edu (Ken Corey - Operator)
  4. Subject: Summary on cpp question from yesterday
  5. Message-ID: <1992Jul29.134422.6362@mercury.unt.edu>
  6. Sender: usenet@mercury.unt.edu (UNT USENet Adminstrator)
  7. Organization: University of North Texas
  8. Date: Wed, 29 Jul 1992 13:44:22 GMT
  9. Lines: 57
  10.  
  11. First I wanna say thanks to all that helped.  This has got to be the most
  12. vocal group I've ever asked a question in...;)
  13.  
  14. Here's the summary about this question:
  15.  
  16. My question was about macro substitution.  The code I'd gotten the macros
  17. that broke under GCC looked like:
  18.   #define MUL(x,y)  ((x) << (y/**/Shift))
  19. and was used like:
  20.   MUL(this,that)
  21. to get:
  22.   ((this) << (that Shift));
  23. where 'that Shift' should have been 'thatShift'.
  24.  
  25. There are two sugestions on how to fix this situation:
  26.  
  27. First, use the -traditional flag with GCC.  This turns off the /**/= ' '
  28. rule, but also has other effects, and is not recommended because it changes
  29. other rules also.
  30.  
  31. Second, instead of /**/, use ## as in:
  32.   #define MUL(x,y)  ((x) << (y##Shift))
  33. to get:
  34.   ((this) << (thatShift));
  35.  
  36.  
  37.  
  38. Thanks to all for your quick response!
  39.  
  40. -Ken
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. -- 
  65. Ken == kenc@sol.acs.unt.edu == kenc@vaxb.acs.unt.edu
  66.  Real Programs don't use shared text.  Otherwise, how can they use
  67.  functions for scratch space after they are finished calling them?
  68.