Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site tikal.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!vax135!cornell!uw-beaver!tikal!warren From: warren@tikal.UUCP (warren) Newsgroups: net.lang.c Subject: Re: typedef gripe Message-ID: <32@tikal.UUCP> Date: Tue, 9-Oct-84 18:32:34 EDT Article-I.D.: tikal.32 Posted: Tue Oct 9 18:32:34 1984 Date-Received: Thu, 11-Oct-84 06:45:22 EDT References: <22286ae4.8e4@apollo.uucp> <142@desint.UUCP> Organization: Teltone Corp., Kirkland, WA Lines: 24 [There are no bugs] It seems to me that typedef'ing something to an array uncovers some ambiguity in the C language, in that array names are constants, not variables. Typedef'ing to a constant is rather odd to begin with. One feels it perhaps ought to be illegal. Or at least very rude. For example, would you accept "typedef 7 foo;" ? Array names are "pointer constants" of the type of "pointer to the first element of the array". Other languages and machines used to call this sort of thing an "address constant". Of course, there is an inconsistancy. The "sizeof(arrayname)" expression is the number of bytes in all the elements of the array. Furthermore, when an arrayname is passed as the actual argument to a function, the formal function argument (in the function) has some other size entirely. On machines that do not address a byte directly, the number of bytes in array of pointers or of floating point constants does not even have to be an integer ! teltone!warren