lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 30 Aug 2006 23:50:16 -0400
From:	Dmitry Torokhov <dtor@...ightbb.com>
To:	Jan Engelhardt <jengelh@...ux01.gwdg.de>
Cc:	Nick Piggin <nickpiggin@...oo.com.au>,
	Andrew Morton <akpm@...l.org>,
	Christoph Hellwig <hch@...radead.org>,
	Richard Knutsson <ricknu-0@...dent.ltu.se>,
	James.Bottomley@...eleye.com, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: Conversion to generic boolean

On Tuesday 29 August 2006 01:58, Jan Engelhardt wrote:
> 
> >> I was kinda planning on merging it ;)
> >> 
> >> I can't say that I'm in love with the patches, but they do improve the
> >> situation.
> >> 
> >> At present we have >50 different definitions of TRUE and gawd knows how
> >> many private implementations of various flavours of bool.
> >> 
> >> In that context, Richard's approach of giving the kernel a single
> >> implementation of bool/true/false and then converting things over to use
> >> it
> >> makes sense.  The other approach would be to go through and nuke the lot,
> >> convert them to open-coded 0/1.
> >
> > Well... we are programming in C here, aren't we ;)
> 
> I like it for the annotation we get.
> 
> 	int fluff;
> 	if(fluff == 0)
> 
> This does not tell if fluff is an integer or a boolean (that is, what the
> programmer intended to do -- not the 'int' the compiler sees).
> If it had been if(!fluff), it would give a hint, but a lot of places also have
> !x where x really is intended to be an integer (and should have been x==0 or
> y==NULL resp.)
>

Bool would not help much either unless declaration is immediately follows
use. I like Alan Sterns proposal ofencode return value in function name
better - actions should always return < 0/0 and predicates should always
be boolean equivalent.
 
-- 
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ