The three laws of the procedural languages programming, by V.Messina:
1 - every function must verify the validity of the ingress parameters
2 - every function must verify the exit status of every called function
3 - every function must return error if one of the two previous checks fail
Notes on the laws:
1 - if parameters are pointers, at least verify that they aren't NULL, apart when it is an acceptable values
1 - use unsigned types (if negative values are unrequested), and always check the top range limit
2
- the check must be done immediately after the function return, it is
unuseful to continue the work if the needed processing are not done
2 - if isn't possible to continue without the results of the called function
3 - you must always return an error that something wrong happen and the work is partially undone
3 - to return the exit status, use the space in the stack, and not global variables or pointer that are thread unsafe
Go to
EFA programming page
Torna alla pagina principale:
EFA home page
Web site showed times since 01/04/2000.
From 20/10/1999 - 31/03/2000 the counter showed 770 visits, but it was resetted from the provider (so add 770 ...)
Copyright (C) 2006,2007,2008 Valerio Messina http://users.iol.it/efa
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts
and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License" or
can be downloaded at: http://www.gnu.org/licenses/fdl.html