home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17694 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.4 KB  |  64 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!spool.mu.edu!darwin.sura.net!gatech!concert!sas!mozart.unx.sas.com!walker
  3. From: walker@twix.unx.sas.com (Doug Walker)
  4. Subject: Re: wierd sas/c bug
  5. Originator: walker@twix.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <Bznxuv.InB@unx.sas.com>
  8. Date: Tue, 22 Dec 1992 13:37:43 GMT
  9. References: <BzIw0y.n31@ccu.umanitoba.ca> <BzM6F7.E6K@unx.sas.com> <BzMGn8.370@ccu.umanitoba.ca>
  10. Nntp-Posting-Host: twix.unx.sas.com
  11. Organization: SAS Institute Inc.
  12. Lines: 50
  13.  
  14.  
  15. In article <BzMGn8.370@ccu.umanitoba.ca>, umfehr06@ccu.umanitoba.ca (John Fehr) writes:
  16. |> OK... here's a compilable example: (hopefully I'll type it in right this
  17. |> time. :)
  18. |> 
  19. |> #include <stdio.h>
  20. |> #undef WHATEVER "test"
  21. |> 
  22. |> char dummy[100]="another test";
  23. |> 
  24. |> main() {
  25. |>   printf("dummy='%s'\n",dummy);
  26. |> }
  27.  
  28. Aha!  This is very different from what you originally posted.
  29.  
  30. Here's what is happening:  whenever the tokenizer sees a quoted
  31. string, it has to "remember" that it saw it, in case the next
  32. non-preprocessor non-comment token is also a quoted string.
  33. The expression parser knows when to "erase" the last quoted
  34. string seen.  In your case, the expression parser isn't being
  35. called because it's an error case - there isn't supposed to be
  36. anything after the thing being #undef'd, so the error case code
  37. just eats tokens until the newline.  Unfortunately, it doesn't
  38. "erase" the string token, so the next quoted string gets 
  39. concatenated to the first one.
  40.  
  41. The workaround is: don't do that!  Comment out the quoted string
  42. on the #undef statement or something.  I've already fixed it in
  43. the source base, but who knows when that will percolate out to
  44. a release - I doubt if it will make 6.2 since that is already frozen.
  45.  
  46. |> I know that #undef WHATEVER "test" isn't ANSI-compliant (the HP-compiler
  47. |> complanes about it anyway) but some programs actually have that in
  48. |> their code.
  49.  
  50. What the heck does it mean?  This doesn't mean anything in K&R dialects
  51. either, as far as I know.
  52.  
  53. |> -  John Fehr                        -    DoD#505    -
  54.  
  55. -- 
  56.   *****
  57. =*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
  58.  *|. o.| ||                                          1200/2400/9600 Dual
  59.   | o  |//     For all you do, this bug's for you!
  60.   ====== 
  61. usenet: walker@unx.sas.com                            bix: djwalker 
  62. Any opinions expressed are mine, not those of SAS Institute, Inc.
  63.  
  64.