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]
Message-ID: <483EABEE.7010807@beta.intcomgrp.com>
Date:	Thu, 29 May 2008 09:13:18 -0400
From:	James Kosin <jkosin@...a.intcomgrp.com>
To:	Johannes Weiner <hannes@...urebad.de>
CC:	linux-kernel@...r.kernel.org
Subject: Re: optimizing out inline functions

Johannes Weiner wrote:
> Hi,
>
> James Kosin <jkosin@...a.intcomgrp.com> writes:
>
>   
>> Sam Ravnborg wrote:
>>     
>>> On Wed, May 28, 2008 at 02:51:02PM -0500, Steve French wrote:
>>>       
>>>> In trying to remove some macros, I ran across another kernel style
>>>>         
>> <<--SNIP-->>
>>     
>>> With reference to a recent thread about kconfig
>>> I would prefer:
>>> static inline void some_debug_function(var1)
>>> {
>>> 	if (KCONFIG_DEBUG_SOMETHING) {
>>> 		something = var1;
>>> 		printk(some debug text);
>>> 	}
>>> }
>>>
>>>
>>> But we do not have KCONFIG_DEBUG_SOMETHING available
>>> so the second best is to use an empty function
>>> to keep the typechecking in place.
>>>
>>> IIRC gcc optimize both away.
>>>       
>> Another way would be to have:
>>
>> static inline void some_debug_function(var1)
>> {
>>    #ifdef KCONFIG_DEBUG_SOMETHING
>>       something = var1;
>>       printk(some debug text);
>>    #endif
>> }
>>
>> BUT, this probably violates some styling rules.
>>     
>
> Without indenting the ifdefs, I think this solution is the best.
>
> It gives you the advantages of type checking but saves a superfluous
> prototype.
>
> 	Hannes
>
>   
Actually, Joe Perches, gave a good reason for using the MACRO #define 
method; so, this could really turn into an interesting discussion.
Pros and Cons are always interesting when there is more than one way to 
do something.

James


Download attachment "signature.asc" of type "application/pgp-signature" (259 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ