|
From: | Dirk Herrmann |
Subject: | Re: typechecking |
Date: | Sat, 15 May 2004 11:16:34 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040220 |
Han-Wen Nienhuys wrote:
address@hidden writes: > When I say "type checking" what really mean is that the compiler > checks whether the user only uses SCM values in the way we want it > to, like, no direct arithmetic, no direct use in conditional tests, > only What's the rationale for not allowing direct use in conditional tests?
Code like the following: void f (SCM obj) { if (obj) { /* do something */ } }is almost always wrong, since what the user typically wants to check is, whether obj is SCM_BOOL_F or not:
void f (SCM obj) { if (!SCM_FALSEP (obj)) { /* do something */ } }The first version, however, will compile if SCM is defined to be some pointer type.
Best regards, Dirk Herrmann
[Prev in Thread] | Current Thread | [Next in Thread] |