data validation (was re self-modifying code)

John F. Haugh II jfh at rpp386.UUCP
Sat Jul 30 17:34:04 AEST 1988


In article <3084 at geac.UUCP> daveb at geac.UUCP (David Collier-Brown) writes:
>From article <61251 at sun.uucp>, by guy at 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 at rpp386.uucp          |             -- with my apologizes



More information about the Comp.lang.c mailing list