|
From: | Royce Pereira |
Subject: | Re: [avr-gcc-list] First steps with avr-gcc |
Date: | Sun, 23 Oct 2005 00:41:29 +0530 |
User-agent: | Opera M2/9.0 (Win32) |
Hi,On Sat, 22 Oct 2005 21:25:49 +0530, Thomas Keller <address@hidden> wrote:
> By default, the compiler is setup to use 16 bit ints. The C language > requires that the & operation promote both sides to ints.I agree, but I believe that when the end result is to be assigned to an 8bit (esp. unsigned char), the code ought to work *as if* it had been promoted, and no actual promotion need be done.I don't think so. One of the nicest things about C is that it generally doesn';t do things behind your back. If you want a type cast or promotion in C, you have to do it explicitly, IIRC.
I thought code optimisation is all about getting rid of redundant code...Well, the bottom line is that the code ends up in a device with limited resources, where time and code size are of the essence. In the real world, it hardly matters whether the code inside the flash is 'conforming' stricctly to some standard, as long as it's bug free, compact and fast.
I mean, will some redundant promotions to int help the code to be better in the field ?
I'm still convinced that only the end result should be the same as if the promotion had been done.
Regards, --Royce. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
[Prev in Thread] | Current Thread | [Next in Thread] |