From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Tue, 8 Jan 2013 11:53:45 -0600 Subject: [U-Boot] [PATCH] Introduce a global bool type In-Reply-To: <20130108174920.BAB22202B69@gemini.denx.de> References: <1357596628-27501-1-git-send-email-yorksun@freescale.com> <20130107223942.94BED20DA7E@gemini.denx.de> <6AE080B68D46FC4BA2D2769E68D765B70820541F@039-SN2MPN1-023.039d.mgd.msft.net> <20130108174920.BAB22202B69@gemini.denx.de> Message-ID: <50EC5D29.1070408@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: > Dear Tabi Timur-B04825, > > In message <6AE080B68D46FC4BA2D2769E68D765B70820541F@039-SN2MPN1-023.039d.mgd.msft.net> you wrote: >>> >>> This seems broken to me. Can we rather try8 and get rid of all this >>> "bool" stuff instead? It's just obfuscating the code... >> >> Like Scott said, we sometimes copy code from Linux that uses 'bool', >> so it's simpler if we just retain this commonly-used type. If it's >> part of the language, how is it obfuscating? Maybe the Linux > > _Bool has been introduced very late to any C standard, and you can > still see this from the ugly, unnatural name. It was introduced in C99, which is over 12 years old. > It is my personal firm conviction that the people pushed it were not > the ones who have been using C right from the beginning, say from the > times of Unix v6 or so. > > IMHO it is much better to rely on '0' meaning "false" and anything > else meaning "true" instead of insisting on one specific value of > "true". Yes, people claim the code is easier to read and understand, > but these are the same people who claim drop-down menues are easier to > work wit than a CLI. And I've seen more than one case where bugs were > caused by using "proper bool types" like this: > > i = 0; > j = 0; > k = 2; > > if ((i | j | k) == true) ... Ok, but this is just wrong. i, j, and k are not boolean types, so they should not be compared with 'true' or 'false'. I don't think you'll find any disagreement with that. -- Timur Tabi Linux kernel developer at Freescale