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

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!gatech!concert!sas!mozart.unx.sas.com!jamie
  3. From: jamie@cdevil.unx.sas.com (James Cooper)
  4. Subject: Re: wierd sas/c bug
  5. Originator: jamie@cdevil.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <BzMMqI.CM1@unx.sas.com>
  8. Date: Mon, 21 Dec 1992 20:39:53 GMT
  9. References: <BzIw0y.n31@ccu.umanitoba.ca> <BzM6F7.E6K@unx.sas.com> <BzMGn8.370@ccu.umanitoba.ca>
  10. Nntp-Posting-Host: cdevil.unx.sas.com
  11. Organization: SAS Institute Inc.
  12. Lines: 41
  13.  
  14.  
  15. In article <BzMGn8.370@ccu.umanitoba.ca>, umfehr06@ccu.umanitoba.ca (John Fehr) writes:
  16. >In <BzM6F7.E6K@unx.sas.com> walker@twix.unx.sas.com (Doug Walker) writes:
  17. >>Please post a COMPILABLE example.  I can virtually guarantee that this
  18. >>is not a compiler bug.  A compiler that broken would not compile
  19. >
  20. >OK... here's a compilable example: (hopefully I'll type it in right this
  21. >time. :)
  22. >
  23. >#include <stdio.h>
  24. >#undef WHATEVER "test"
  25. >
  26. >char dummy[100]="another test";
  27. >
  28. >main() {
  29. >  printf("dummy='%s'\n",dummy);
  30. >}
  31. >
  32. >That SHOULD (it does for me) print out something totally unexpected.
  33. >What's almost as wierd, is if you #include something after the
  34. >#undef.  (an empy .h file will do)
  35. >I know that #undef WHATEVER "test" isn't ANSI-compliant (the HP-compiler
  36. >complanes about it anyway) but some programs actually have that in
  37. >their code.
  38.  
  39. Wow... good one!  How about an official EMITS report, just to make us happy! :-)
  40.  
  41. It appears the first "test" is getting merged with the "another test" string,
  42. per ANSI concatenation rules, such that you get:
  43.  
  44. dummy = 'testanother test'
  45.  
  46. when you compile and run this sample program... wierd!
  47.  
  48. -- 
  49. ---------------
  50. Jim Cooper
  51. (jamie@unx.sas.com)                             bix: jcooper
  52.  
  53. Any opinions expressed herein are mine (Mine, all mine!  Ha, ha, ha!),
  54. and not necessarily those of my employer.
  55.