Article View: comp.std.c
Article #3454Re: (no subject) [cast expression as an lva
From: Michael Shields
Date: Wed, 11 Oct 1995 04:16
Date: Wed, 11 Oct 1995 04:16
16 lines
1071 bytes
1071 bytes
In article <45ef3f$n8u@engnews2.Eng.Sun.COM>, Steve Clamage <clamage@Eng.Sun.COM> wrote: > What's interesting is that you can get the same effect with valid code > that should generate the same object code as the invalid original. > For example, instead of > ((char*)src)++; > you can write > (*(char**)(&src))++; > I don't claim this code is more readable, but you could encapsulate the > ugliness in a macro. For example: > #define increment_as(ptr, T) ((*(T*)(&ptr))++) > increment_as(src, char*); If it is always possible, why not just legalize the first syntax? -- Shields.
Technical Details
Message-ID:
<45fgea$d8j@yage.tembel.org>Path:
arc1-ca.pugleaf.net!news.tembel.org!not-for-mailReferences:
<45e68p$t78@inferno.mpx.com.au> <45ef3f$n8u@engnews2.Eng.Sun.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.tembel.org!not-for-mail From: shields@tembel.org (Michael Shields) Newsgroups: comp.std.c,comp.lang.c,comp.unix.solaris Subject: Re: (no subject) [cast expression as an lva Date: 11 Oct 1995 04:16:10 -0000 Organization: Tembel's Hedonic Commune Distribution: inet Message-ID: <45fgea$d8j@yage.tembel.org> References: <45e68p$t78@inferno.mpx.com.au> <45ef3f$n8u@engnews2.Eng.Sun.COM> NNTP-Posting-Host: yage.tembel.org NNTP-Posting-User: shields