From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17612 invoked by alias); 23 Nov 2004 16:31:21 -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 17436 invoked from network); 23 Nov 2004 16:31:06 -0000 Received: from unknown (HELO mail.libertysurf.net) (213.36.80.90) by sourceware.org with SMTP; 23 Nov 2004 16:31:06 -0000 Received: from dyn-83-156-222-3.ppp.tiscali.fr (83.156.222.3) by mail.libertysurf.net (7.1.026) id 41A307DC00058E98; Tue, 23 Nov 2004 17:31:03 +0100 From: Eric Botcazou To: Andrew Pinski Subject: Re: generalized lvalues -- patch outline Date: Tue, 23 Nov 2004 16:50:00 -0000 User-Agent: KMail/1.6.1 Cc: gcc@gcc.gnu.org, Michael Matz , Steve Naroff , Matt Austern , Daniel Berlin , Ziemowit Laski , Nathan Sidwell , Joe Buck , Mike Stump References: <4D2CF60C-3919-11D9-8BD2-000A95BCF344@apple.com> <4D0584E2-3D61-11D9-AEB4-000A95D692F4@physics.uc.edu> In-Reply-To: <4D0584E2-3D61-11D9-AEB4-000A95D692F4@physics.uc.edu> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200411231728.58506.ebotcazou@libertysurf.fr> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-SW-Source: 2004-11/txt/msg00824.txt.bz2 > 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). I disagree: *((int *)p)++ was accepted by virtually all the good old compilers: GCC 2.x, Microsoft, Borland, Watcom. This is a natural idiom when you're manipulating images with different color depths: char *p = bitmap->data; switch (color_depth) {     case 8:     *p++ = c;       break; case 15:     case 16:     *((short *)p)++ = c; break;     case 32:     *((int *)p)++ = c; break;    } Of course, nowadays everything is 32-bit so... :-) And char *a1 = (char*)a; a1 += sizeof(int)/sizeof(char); a = (typeof(a))(a1); is plain ugly. -- Eric Botcazou