home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.11 / text0073.txt < prev    next >
Encoding:
Internet Message Format  |  1987-07-18  |  1.4 KB

  1. From: simon@its63b.ed.ac.uk (Simon Brown)
  2.  
  3. In article <8271@ut-sally.UUCP> Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA> writes:
  4. >From: Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA>
  5. >
  6. >I submitted a proposal to X3J11 that fflush((FILE*)NULL) would
  7. >flush ALL output buffers, since there is no other good way to
  8. >accomplish that.  It seems that close(-1) might be a similar
  9. >solution for POSIX.  (Since nobody is supposed to be doing this
  10. >currently, it is available for assigning new semantics to.)
  11. >
  12.  
  13. Arghhh, no! Don't do that! Ok, it might seem a truly wonderful idea, but
  14. it would mean that things like
  15.     fd = open(some-random-filename,something);
  16.     do-something-bizarre-with-fd;
  17.     close(fd);
  18. will do a "close(-1)" if the open happened to fail for some reason or other,
  19. which is harmless at the moment (just returns -1, errno=EBADF), but would be
  20. a bit tragic with this new semantics!
  21. Yes, I know this isn't a problem if everyone always checks the return-value
  22. from open(), creat(), etc..., but lots of programs aren't that pessimistic!
  23.  
  24. -- 
  25. ----------------------------------
  26. | Simon Brown                  | UUCP:  seismo!mcvax!ukc!{its63b,cstvax}!simon
  27. | Department of Computer Science | JANET: simon@uk.ac.ed.{its63b,cstvax}
  28. | University of Edinburgh,       | ARPA:  simon%{its63b,cstvax}.ed.ac.uk ...
  29. | Scotland, UK.             |                @cs.ucl.ac.uk
  30. ----------------------------------     "Life's like that, you know"
  31.  
  32. Volume-Number: Volume 11, Number 74
  33.  
  34.