home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / ada / 3747 < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.4 KB  |  30 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!news.service.uci.edu!network.ucsd.edu!news!cod!sampson
  3. From: sampson@nosc.mil (Charles H. Sampson)
  4. Subject: Functions That Only Raise an Exception
  5. Message-ID: <1992Dec17.193104.27782@nosc.mil>
  6. Organization: Computer Sciences Corporation
  7. References: <EACHUS.92Dec15202249@oddjob.mitre.org> <256@visicom.com> <1992Dec16.200205.8912@linus.mitre.org>
  8. Date: Thu, 17 Dec 1992 19:31:04 GMT
  9. Lines: 19
  10.  
  11. In article <1992Dec16.200205.8912@linus.mitre.org> jclander@texas.mitre.org (Julian C. Lander) writes (responding to a request for an example of a function that does nothing but raise an exception):
  12.  
  13. >I didn't write this one, but it is in some code I'm using.
  14. >The situation is interface with C-language functions, which return
  15. >error codes.  The chunk of code before me (I don't know a good noun
  16. >for what it is--it builds about 3 different executables) has a function
  17. >called Raise_Appropriate_Exception, which raises the exception 
  18. >corresponding to the return code it has been passed.
  19. >
  20. >Since it never gets a 0 (its caller should avoid that), it doesn't return.
  21. >
  22. >I don't know that it's the best solution to the problem (I'm not wild
  23. >about it, frankly), but that's what I have.
  24.  
  25.      I can think of a number of questions about this function.  The one
  26. I'm most interested in is why is it a function rather than a procedure?
  27. Particularly a function whose name is a verb phrase?
  28.  
  29.                 Charlie
  30.