Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!ucsd!ames!killer!vector!rpp386!jfh From: jfh@rpp386.UUCP (John F. Haugh II) Newsgroups: comp.lang.c Subject: Re: data validation (was re self-modifying code) Summary: interface specifications. Message-ID: <4661@rpp386.UUCP> Date: 30 Jul 88 07:34:04 GMT References: <61251@sun.uucp> <3084@geac.UUCP> Reply-To: jfh@rpp386.UUCP (The Beach Bum) Organization: Big "D" Home for Wayward Hackers Lines: 33 In article <3084@geac.UUCP> daveb@geac.UUCP (David Collier-Brown) writes: >From article <61251@sun.uucp>, by guy@gorodish.Sun.COM (Guy Harris): >> input data before using it (unless they have good reason to know the data will >> *never* be incorrect); > > When I look in my Mutlics standard systems designers' notebook, I >find the following words of wisdom... > > Subroutines should not check the number or type of input > arguments, but assume they have been called correctly. in my humble opinion, subroutines on the interface boundary SHOULD check their arguments for conformity to the interface definition. once inside of a system of subroutines, there is no need to check for out of band data. a well defined interface will specify the action to be taken on each type of out of band data. a very well defined interface will specify EXACTLY how to deal with out of band values. > Depending on the hrdware or compiler to catch invalid data by >trapping on its use has been a known bad practice since well before >Unix... The manual above is a reprint, circa 1980. unix has been around longer than since circa 1980. DEC would seem to disagree since they included the trap on overflow/etc exceptions to their double precision machine operands when they created the VAX family of minicomputers. -- John F. Haugh II +--------- Cute Chocolate Quote --------- HASA, "S" Division | "USENET should not be confused with UUCP: killer!rpp386!jfh | something that matters, like CHOCOLATE" DOMAIN: jfh@rpp386.uucp | -- with my apologizes