From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12615 invoked by alias); 23 Nov 2004 20:16:40 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 12500 invoked from network); 23 Nov 2004 20:16:23 -0000 Received: from unknown (HELO sadr.equallogic.com) (66.155.203.134) by sourceware.org with SMTP; 23 Nov 2004 20:16:23 -0000 Received: from sadr.equallogic.com (localhost.localdomain [127.0.0.1]) by sadr.equallogic.com (8.12.8/8.12.8) with ESMTP id iANKGN2B016957 for ; Tue, 23 Nov 2004 15:16:23 -0500 Received: from M30.equallogic.com (m30 [172.16.1.30]) by sadr.equallogic.com (8.12.8/8.12.8) with SMTP id iANKGNqn016952; Tue, 23 Nov 2004 15:16:23 -0500 Received: from pkoning.equallogic.com ([172.16.1.220]) by M30.equallogic.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 23 Nov 2004 15:16:22 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16803.39574.32539.497659@gargle.gargle.HOWL> Date: Tue, 23 Nov 2004 21:21:00 -0000 From: Paul Koning To: kunert@physik.tu-dresden.de Cc: gcc@gcc.gnu.org Subject: Re: generalized lvalues -- patch outline References: <4D2CF60C-3919-11D9-8BD2-000A95BCF344@apple.com> <4D0584E2-3D61-11D9-AEB4-000A95D692F4@physics.uc.edu> <200411231728.58506.ebotcazou@libertysurf.fr> <16803.26864.624255.231502@gargle.gargle.HOWL> <41A37B13.9040100@physik.tu-dresden.de> X-OriginalArrivalTime: 23 Nov 2004 20:16:22.0960 (UTC) FILETIME=[4D422B00:01C4D199] X-SW-Source: 2004-11/txt/msg00845.txt.bz2 >>>>> "Thomas" == Thomas Kunert writes: Thomas> Paul Koning wrote: >>>>>>> "Eric" == Eric Botcazou writes: >> >> >> >> The average C programmer would not have thought to use this >> >> extension unless they just decided one day to try it or they >> >> actually read the gcc documentation (which I know almost nobody >> >> does). >> Eric> I disagree: *((int *)p)++ was accepted by virtually all the Eric> good old compilers: GCC 2.x, Microsoft, Borland, Watcom. This Eric> is a natural idiom when you're manipulating images with Eric> different color depths ... >> ... or doing alignment-optimized copying. I've seen this notation >> in our code, and I'm pretty sure the author didn't get it from the >> GCC docs. It's a natural thing to write -- unless you ARE a >> language lawyer and understand the hairy details of precisely what >> is an lvalue and what is not. >> Thomas> A union is the correct solution. Thomas> union { char* c; int* i; short* s; } p; Thomas> *p.i++; But that depends on char* and int* having the same representation, doesn't it? paul