From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2564 invoked by alias); 23 Nov 2004 18:02:10 -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 2430 invoked from network); 23 Nov 2004 18:01:57 -0000 Received: from unknown (HELO mailgate.urz.tu-dresden.de) (141.30.66.154) by sourceware.org with SMTP; 23 Nov 2004 18:01:58 -0000 Received: from [127.0.0.1] (helo=localhost) by mailgate.urz.tu-dresden.de with esmtp (exim-4.22) id 1CWezE-0000jt-8l; Tue, 23 Nov 2004 19:01:56 +0100 Received: from mailgate.urz.tu-dresden.de ([127.0.0.1]) by localhost (rks24 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02406-09; Tue, 23 Nov 2004 19:01:55 +0100 (MET) Received: from [141.30.17.64] (helo=ptprs1.phy.tu-dresden.de) by mailgate.urz.tu-dresden.de with esmtp (exim-4.22) id 1CWezD-0000jd-Fp; Tue, 23 Nov 2004 19:01:55 +0100 Received: from physik.tu-dresden.de (ptpp80.phy.tu-dresden.de [141.30.17.240]) by ptprs1.phy.tu-dresden.de (AIX4.3/8.9.3/8.9.3) with ESMTP id TAA03074; Tue, 23 Nov 2004 19:01:54 +0100 Message-ID: <41A37B13.9040100@physik.tu-dresden.de> Date: Tue, 23 Nov 2004 18:03:00 -0000 From: Thomas Kunert User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 MIME-Version: 1.0 To: Paul Koning 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> In-Reply-To: <16803.26864.624255.231502@gargle.gargle.HOWL> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-TUD-Virus-Scanned: by amavisd-new at rks24.urz.tu-dresden.de X-TUD-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on rks24 X-SW-Source: 2004-11/txt/msg00832.txt.bz2 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. > A union is the correct solution. union { char* c; int* i; short* s; } p; *p.i++; TK.