Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!geacc022%timevx@cit-hamlet.arpa From: geacc022%timevx@cit-hamlet.arpa Newsgroups: net.lang.c Subject: Casting call Message-ID: <10784@brl-tgr.ARPA> Date: Fri, 17-May-85 11:45:41 EDT Article-I.D.: brl-tgr.10784 Posted: Fri May 17 11:45:41 1985 Date-Received: Sun, 19-May-85 00:28:03 EDT Sender: news@brl-tgr.ARPA Lines: 22 >This discussion has brought up another point -- somebody posted an example >where he casted a lhs, and somebody pointed out that you can't do that. >What I am wondering is, why can't you? There seem to be no semantic problems >involved, and it can be very useful for something like: > >#define FREE(ptr) free(char *) ptr); (char *) (ptr) = (char *) -1; There are indeed problems with this. What if you're on a machine where char * is 32 bits, but int * is only 16 bits? What you really want is a "typeof" operator: #define FREE(ptr) { free((char *) ptr); ptr = (typeof ptr) NULL; } Unfortunately, this doesn't exist either. :-( Gary Ansok GEACC022%TIMEVX @ CIT-HAMLET.ARPA GEA @ CALTECH.BITNET ...ucbvax!cithep!timevx#geacc022 "All the world loves a straight man."