home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.17 / text0029.txt < prev    next >
Encoding:
Text File  |  1990-01-06  |  1.5 KB  |  41 lines

  1. In article <403@longway.TIC.COM> uunet!dg-rtp.dg.com!dg-rtp!meissner (Michael Meissner) writes:
  2. >|  In article <401@longway.TIC.COM>, gwyn@BRL.MIL quotes someone:
  3. >|  > >3) that the final version be
  4. >|  > >    b) portable to ALL UNIX SYSTEMS
  5. >|  and then says ..
  6. >|  > Wow, taken literally this would be EXTREMELY TOUGH.
  7. >| [yet another contestant's entry here]
  8. >You still lose.  Under ANSI C the above program is not valid, since
  9. >printf is a varargs function that has no prototype in scope.  While we
  10. >are at it, main should return a valid exit status.  Ok, the revised
  11. >program is:
  12. >    #include <stdio.h>
  13. >    main()
  14. >    {
  15. >        printf("Hello world\n");
  16. >        return 0;
  17. >    }
  18.  
  19. UNIX systems are not general ANSI C conforming at present.
  20. Some of them may not even support main() with no parameters..
  21. I know that some of them ignore the value retuned by main()
  22. and pretend it returned "success" status (0), but that doesn't
  23. break the above program.
  24.  
  25. Certainly, back in prehistory, some UNIX systems did not have
  26. <stdio.h>.  One would hope there are none like that still in
  27. operation, but I wouldn't bet on it.
  28.  
  29. What Mike says is correct in the context of Standard C.
  30.  
  31. If there is this much variation possible simply in the UNIX
  32. portability of the "Hello, world" program, imagine how much
  33. more difficult it would be for a GRAPHICS program (as in the
  34. original specification).  By the way, we all understand the
  35. "graphics" requirement to not be satisfied by a text-oriented
  36. program.
  37.  
  38. Volume-Number: Volume 17, Number 34
  39.  
  40.  
  41.