Path: utzoo!attcan!uunet!mcsun!ukc!stc!inset!mikeb From: mikeb@inset.UUCP (Mike Banahan) Newsgroups: comp.lang.c++ Subject: Type of address of array Keywords: typedef borland zortech cfront Message-ID: <1649@inset.UUCP> Date: 11 Oct 90 17:32:43 GMT Organization: The Instruction Set Ltd., London, UK. Lines: 32 Here is an interesting "feature" of the Zortech R2.1, Borland and AT&T R2.0 C++ compilers: main(){ typedef int iar[4]; iar localitem; iar *iap; iap = &localitem; // type error - address of localitem // is not of type int (*)[4] } This, whilst correct in Old C (address of an array is not a meaningful operation), is not correct by the rules of ANSI C, where the address of an array is a pointer to the whole array. Ellis and Stroustrup, 5.3, does say that the operand of & must be an lvalue, but I can hardly think that this is what was intended. Ho humm. The important point in this is not so much that I can't get around it, but that it blows up when I try to apply new() to one of these: iap = new iar; which is a pain in the rear end and no mistake. Perhaps somebody has some insight into how to avoid this apart from just kludging it with casts? Mike Banahan -- Mike Banahan, Technical Director, The Instruction Set Ltd. mcvax!ukc!inset!mikeb