Thorsten Ottosen <[EMAIL PROTECTED]> writes: > I'll respond to all 3 messages by this. > > ----- Original Message ----- > From: "Gennaro Prota" <[EMAIL PROTECTED]> > > >> On Sun, 17 Nov 2002 18:22:20 +0100, Thorsten Ottosen >> <[EMAIL PROTECTED]> wrote: >> >> >Yes, but note that having both is less fortunate. Either we agree that >> >library writers check preconditions and then >> >clients don't or we agree that clients check preconditions and library >> >writers don't. One reason that C is such >> >a pain in the *** to use is because its the cliets responsibility to > check >> >conditions , e.g. >> > >> >int * i = malloc( sizeof( i ) ); >> >assert( i ); >> >> Well, apart from the C-style void*->int* conversion and the curious >> sizeof(i) instead of sizeof(int), weren't you speaking of >> preconditions? :-) > > Well, my point is that if you put the check in the library, then you > do it once; if you don't put it there, then you do it n times. It > does not matter what the check is.
But n can be 1 if you provide your own checked interface wrapper <wink>. > On Sun, 17 Nov 2002 12:53:52 -0500, David Abrahams > <[EMAIL PROTECTED]> wrote: >>Not all preconditions are effectively checkable > > then how should the client check them? I assume the client cannot > check the preconditions any better than the library. Right, but the client can ensure they're true via other means. For example, if I write a function taking an A* parameter, how can I check that the user hasn't passed something crazy, like (A*)some_array_of_char? I can't. Clearly it is a precondition that the A* parameter point to an A (or be NULL). However, the client has it entirely within his power to avoid passing me bogus data. -- David Abrahams [EMAIL PROTECTED] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost