generalized lvalues -- patch outline

Gabriel Dos Reis gdr@integrable-solutions.net
Tue Nov 23 15:56:00 GMT 2004


Michael Matz <matz@suse.de> writes:

| Hi,
| 
| On Tue, 23 Nov 2004, Andrew Pinski wrote:
| 
| > if you had the following:
| > 
| > ((int*)a)++;
| > 
| > the better idea would be:
| > 
| > char *a1 = (char*)a;
| > a1 += sizeof(int)/sizeof(char);
| > a = (typeof(a))(a1);
| 
| Ah, yes ;-)
| 
| I disagree.  The better idea would have been if the C language would allow 
| for the first construct.  It's shorter, and by giving this rewriting rule 
| seems also to be easy to define.

Short is good, when it does not introduce confusion and unnecessary
complexity. 
Specialized macros for such questionable constructs are better.

-- Gaby



More information about the Gcc mailing list