avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Code Optimisation question re: volatile


From: David Brown
Subject: Re: [avr-gcc-list] Code Optimisation question re: volatile
Date: Fri, 23 Jul 2004 17:15:06 +0200

> On 23 Jul 2004 at 8:36, David Brown wrote:
>
> OT:
>
> > If you really want to use an ugly assign-to-assignment-result syntax
(and
> > they are ugly, and low readability, and banned by any decent coding
> > standard),
>
> IYHO.

That's implied by such opinionated statements :-)

>
> One could also make the case for inline-if operator (c ? x : y).
>

Indeed one could, although I would not recommend an outright ban - I seldom
use it myself, but if it makes the code clearer then use it.

> But, one could also say that outright banning of simple legal constructs
(that have negligible
> side-effects) is caused by a failure of understanding of the language. ;-)
>

Certainly true.  I think constructs should be avoided when there are clearer
and more readable ways to write the same code (without reducing the quality
of the generated code), but not just because they are a less commonly used
part of the language.

I don't actually give much weight to coding standards that I've seen - they
frequently either don't go far enough, or ban a lot of constructs that are
mostly a bad idea, but occasionally very useful.  For example,
assign-to-assignment-result can be a neat way to write things like "if (key
= readKey()) ... ", but writing "x = *y++ = z" is never a good idea!

David

> Eric
>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]