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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 24 May 2008 16:46:27 +0200
From:	Willy Tarreau <w@....eu>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Sam Ravnborg <sam@...nborg.org>, "H. Peter Anvin" <hpa@...or.com>,
	Steve French <smfrench@...il.com>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: kernel coding style for if ... else which cross #ifdef

On Sat, May 24, 2008 at 03:41:21PM +0100, Jeremy Fitzhardinge wrote:
> Willy Tarreau wrote:
> >You still have the possibility to use the "-0" trick :
> >
> > 	if (CFG_THINGY_LIMIT && x > (CONFIG_THINGY_LIMIT-0)) {...}
> >  
> 
> Oh, that's cute in a vile way.  I hadn't seen it before.

I use it in some of my code (but moderately). It's particularly useful
for limit checking such as above. It's useful too when you want to use
the config value as an offset or a bit shift. Eg:

    p = malloc(buf_size << (CONFIG_SHIFT-0));

Willy

--
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