Re: Writing bulletproof code
From: Programmer Dude (Chris_at_Sonnack.com)
Date: 01/06/04
- Next message: Programmer Dude: "Re: Academic research aimed at improving programmer productivity?"
- Previous message: Programmer Dude: "Re: PL/I string representations"
- In reply to: Arthur J. O'Dwyer: "Re: Writing bulletproof code"
- Next in thread: Arthur J. O'Dwyer: "Re: Writing bulletproof code"
- Reply: Arthur J. O'Dwyer: "Re: Writing bulletproof code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 06 Jan 2004 12:19:20 -0600
"Arthur J. O'Dwyer" wrote:
I guess my question is...
> If I want to write a function in C that takes a user-id
> as a parameter, I not only have to check that the string is
>
> 1) not empty
> and 2) well-formed
>
> but also, because of the form of the language, I must check that
> it is
>
> 3) not a null pointer
>
> and *also*, because of the lack of "check-ability," I am *unable*
> to check that it is
>
> 4) a null-terminated string
> 5) not a wild pointer
> 6) not a floating-point value reinterpreted as a string
> 7) not a pointer to a value that may change at whim
>
> ...and so on.
...what are the relative chances of the above errors? IME, as
initializing to NULL, or using NULL as an error return value, is
very common, erroneously receiving a NULL pointer has a fairly
high likelihood.
Thus, IMO, it is reasonable to check for.
-- |_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? | |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL | |_____________________________________________|_______________________|
- Next message: Programmer Dude: "Re: Academic research aimed at improving programmer productivity?"
- Previous message: Programmer Dude: "Re: PL/I string representations"
- In reply to: Arthur J. O'Dwyer: "Re: Writing bulletproof code"
- Next in thread: Arthur J. O'Dwyer: "Re: Writing bulletproof code"
- Reply: Arthur J. O'Dwyer: "Re: Writing bulletproof code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|