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

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

Re: [avr-gcc-list] efficiency of assigning bits (getting OT)


From: Graham Davies
Subject: Re: [avr-gcc-list] efficiency of assigning bits (getting OT)
Date: Mon, 21 Mar 2005 07:40:10 -0500

David Brown wrote:

> I don't know about you, but I consider the optimizer to be part of my
> tool set, just like the compiler itself.  If the compiler is capable of
> generating good object code from my preferred form of source code
> expression, then I don't care whether ANSI says it is "sort of cheating
> but all right in this case".

I agree.  But, I think you've lost track of the discussion (sub-)topic.

Jim Brain implied that because you can't see evidence of integer promotions
in generated code that the C language definition does not require them.  My
point in my reply was that this is not true.  Jim's reply to that suggests
that he thinks my position is mere pedantry.  During discussions of
programming language definitions I have found that an accusation of pedantry
is usually a signal to give up the thread.  You will have to decide for
youself who is right and whether or not you care.

> ... There are times when C's integer promotion is a PITA ...

Which is why I personally insist on a full understanding.

> ... but for simple bit manipulation, all the compilers I have
> used on 8-bit architectures have been smart enough to
> generate sensible code.

But not all 8-bit compilers in the world.

> Unnecessarily sprinkling the code
> with (unsigned char) casts does nothing for the code efficiency, or code
> portability, and detracts from code readability - so don't do it.

Right - with emphasis on the first word of your sentence.

Graham.





reply via email to

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