Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Does ANSI C have lengthof() ? Message-ID: <6404@brl-smoke.ARPA> Date: Fri, 4-Sep-87 12:08:40 EDT Article-I.D.: brl-smok.6404 Posted: Fri Sep 4 12:08:40 1987 Date-Received: Sat, 5-Sep-87 18:07:04 EDT References: <9154@brl-adm.ARPA> <1265@mhres.mh.nl> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <1265@mhres.mh.nl> jv@mhres.mh.nl (Johan Vromans) writes: - # if sizeof (char*) == sizeof (int) - typedef int numptr; - # else - # if sizeof (char*) == sizeof (long) - typedef long numptr; - # endif - # endif - # if unknown (typeof (numptr)) - .... error .... - # endif 99 times out of 100, the above should be written as: typedef char *numptr; People should STOP trying to do integer arithmetic with what are nominally pointer values -- it is most unlikely to be portable, and practically all portable uses do not require such kludgery!