home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18893 < prev    next >
Encoding:
Text File  |  1992-12-25  |  2.3 KB  |  57 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: Another C palindrome puzzle
  5. Message-ID: <9236108.5556@mulga.cs.mu.OZ.AU>
  6. Sender: news@cs.mu.OZ.AU
  7. Organization: Computer Science, University of Melbourne, Australia
  8. References: <9234503.17437@mulga.cs.mu.OZ.AU> <9235703.672@mulga.cs.mu.OZ.AU> <1992Dec23.172745.12170@thunder.mcrcim.mcgill.edu>
  9. Date: Fri, 25 Dec 1992 21:28:26 GMT
  10. Lines: 45
  11.  
  12. mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
  13.  
  14. >In article <9235703.672@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  15. >> manus@evolving.com (Manus Hand) writes:
  16. >
  17. >>> how about a palindromic "Hello world" program, with no comments,
  18. >>> #if's, #ifdef's, <<<OR #define's!>>>
  19. >> I liked your idea of using #pragma.
  20. >> Here's my solution with no comments, #ifs, #ifdefs, or #defines.
  21. >
  22. >>     #pragma amgarp#;""\
  23. >
  24. >Oops.  What about the FrobozzCo compiler, which takes the "amgarp"
  25. >pragma as a directive to place the author of the code into the world of
  26. >_The World According to Garp_? [...]
  27.  
  28. Well... just so long as it still accepts the program :-).
  29.  
  30. >Or older versions of gcc, which would give up on compiling and run rogue
  31. >when they happened across a #pragma of any sort?
  32.  
  33. I think that these versions of gcc are not standard-conforming.
  34. I don't have the ANSI C standard, but the C++ ARM says that
  35. "an unrecognized pragma will be ignored", and I think that the C standard
  36. says something similar.
  37.  
  38. So the program should be fine on all conforming implementations that don't
  39. recognize the pragma
  40.      #pragma amgarp#;""
  41. ie., all conforming implementations ever actually implemented (but not of
  42. course the FrobozzCo compiler with the -mumble option specified ;-)
  43.  
  44. But you're right of course, it's not strictly ANSI conforming.
  45.  
  46. -- 
  47. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  48. This .signature virus is a self-referential statement that is true - but 
  49. you will only be able to consistently believe it if you copy it to your own
  50. .signature file!
  51.  
  52. -- 
  53. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  54. This .signature virus is a self-referential statement that is true - but 
  55. you will only be able to consistently believe it if you copy it to your own
  56. .signature file!
  57.