From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Thu, 02 Dec 2010 19:51:36 +0100 Subject: [U-Boot] [PATCH] omap3evm: Clean-up EVM detection code. In-Reply-To: <4CF7C7F4.6030803@free.fr> References: <1291288812-12653-1-git-send-email-premi@ti.com> <20101202113726.2C683EA6600@gemini.denx.de> <4CF7896B.5090007@free.fr> <20101202120141.30416EA6600@gemini.denx.de> <4CF7922B.3020504@free.fr> <20101202135804.3BACFEA6600@gemini.denx.de> <4CF7C7F4.6030803@free.fr> Message-ID: <20101202185136.499ACEA6600@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Albert ARIBAUD, In message <4CF7C7F4.6030803@free.fr> you wrote: > > > Well, an u8 is as good a data type as any other. The available range > > of 0...255 seems more than sufficient to store the needed > > information, so why should I waste 4 bytes of storage when a single > > byte is sufficient as well? > > You don't necessarily use only one byte when declaring an u8 instead of > an int, because the next declaration may have alignment requirements > that will cause the compiler to skip bytes after the u8. Besides, u8 is The compiler / linker may (or may not) optimize this and collect variables of similar alignment. An "int foo;" is likely to end in .bss segment, while an "char foo;" will probably show up in .sbss - I don;t know how good or bad the current situation for ARM is, but I'm sure it is improving (look for example at all the microoptimizations done by Linaro). > not "as good a data type" as any other, it is a specific data type > whereas 'int' is the native data type of the platform, supposed to be > the most natural to deal with for the cpu -- 32-bit for an ARM. Can an ARM CPU not read1s and write single bytes, too? > u8 are perfect and normal, for instance, as fields of a structure which > represents byte registers, or to perform 8-bit arithmetic. Here, > however, there is indeed no reason to use any specific type, so we > should use the cpu's native type. I do not share your opinion. But this is a pretty academic topic, and I'm neither in the mood nor do I have the time for lengthy discussions. Let's stop this here. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Cigarette, n.: A fire at one end, a fool at the other, and a bit of tobacco in between.