Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.os.minix Subject: Re: struct pointers Message-ID: <14726@mimsy.UUCP> Date: 27 Nov 88 01:56:38 GMT References: <5092@whuts.ATT.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 15 >>struct { int m; } sa[1]; >>sa->m = 0; /* Compiler chokes on this */ In article <5092@whuts.ATT.COM> mjs@whuts.ATT.COM (SCHEUTZOW) writes: >[This] seems like a misuse of the pointer operator to me; .... It is correct. An object of type `array of T' in an rvalue context is converted to an rvalue of type `pointer to T' whose value is the address of the 0'th array element. The left hand side of the `->' operator demands an rvalue expression of type `pointer to struct-or-union'; `sa' here becomes `pointer to struct ', and the rhs `m' is a member of this structure, so all is fine. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris