Re: When to validate?

From: Antoine Leca (Antoine10646@leca-marti.org)
Date: Fri Dec 10 2004 - 11:38:23 CST

  • Next message: Andy Heninger: "Re: When to validate?"

    Arcane Jill va escriure:

    > And yet, in an expression such as tolower(trim(s)), the second
    > validation is unnecessary. The input to tolower() /must/ be valid,
    > because it is the output of trim(). But on the other hand, tolower()
    > could be called with arbitrary input, so I can't skip the validation.

    What is a "string" ?

    If you are using C as language, this is a particularly valid question, since
    the output can be larger than the input in general, so you will be resorted
    to add a maximum length parameter, or allowing realloc() which means that
    the strings are required to be malloc'ed on first place.

    As a result, your strings are likely to be some stuctures.
    Then, it is pretty easy to add some s_valid flag, and you are done.

    Antoine



    This archive was generated by hypermail 2.1.5 : Fri Dec 10 2004 - 11:41:46 CST