From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Knutsson Date: Sun, 21 Jan 2007 10:58:28 +0000 Subject: Re: [KJ] standardizing on boolean variables? Message-Id: <45B34754.5060908@student.ltu.se> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kernel-janitors@vger.kernel.org Robert P. J. Day wrote: > On Sun, 21 Jan 2007, Alexey Dobriyan wrote: > > >> On Sun, Jan 21, 2007 at 03:36:33AM -0500, Robert P. J. Day wrote: >> >>> p.s. the source file drivers/scsi/BusLogic.c repeatedly refers to the >>> token "true", but it's not clear where *that's" being defined. goes >>> gcc actually recognize the token "true"? that's supposed to be >>> defined in C99's , but that's clearly not being used here. >>> >> When in doubt see preprocessor output: >> >> make drivers/scsi/BusLogic.i >> >> # 1 "/home/linux/linux-irq-flags-t/include/linux/stddef.h" 1 >> # 15 "/home/linux/linux-irq-flags-t/include/linux/stddef.h" >> enum { >> false = 0, >> true = 1 >> }; >> >> Indeed, "true" is right there. >> > > ah, quite right, i missed that. but that, of course, just raises > another question -- why have two different sets of tokens representing > boolean values? should programmers use the upper or lower case form? > and why did the person who wrote BusLogic.c do it differently from > everyone else? so many pedantic, anal-retentive questions. > Simple, some people defines 'FALSE'/'TRUE' and some 'false'/'true' ;) Then, to be able to compile, the "6e21828743247270d09a86756a0c11702500dbfb" (git show) redefined BusLogic.h's -typedef enum { false, true } __attribute__ ((packed)) boolean; to +typedef bool boolean; Also, NTFS has been converted and some more filesystems. > but back to the question at hand -- is there any fundamental problem > with trying to define a standard by defining TRUE and FALSE macros in > types.h? certainly, that would also require some simultaneous fixes > to the source tree, where those new macros would clash with existing > code, like in drivers/net/wireless/strip.c, where one would have to > remove the conflicting: > > enum { FALSE = 0, TRUE = 1 }; > > but i'm guessing things like that would be rare. > Please, try to convert it to 'false'/'true' instead. It is meant to be the generic boolean-values, same as bool being the type. Believe it is approved since I saw a patch, adding a function using bool and 'false'/'true', signed-off-by Torvalds and Morton (not sure it was a third name). I have not got too much done in the converting-front (some wants it changed to int/0/1 instead); maybe this is something to add on Wiki- ToDo :) Richard Knutsson _______________________________________________ Kernel-janitors mailing list Kernel-janitors@lists.osdl.org https://lists.osdl.org/mailman/listinfo/kernel-janitors