Replacement of "#if 0" by "if (0)" blocks

James McKenzie jjmckenzie51 at earthlink.net
Sun May 30 12:33:44 CDT 2010


Frédéric Delanoy wrote:
> Hi folks,
>
> after seeing aafef7cdd56e488d2f42eb01190e51ce6148b664 (Use if(0)
> instead of #if 0 to make sure code still compiles),
> IMHO, except special cases (like maybe in headers files), those '#if
> 0' have no advantages compared to "if (0)" (besides
> being highlighted in vim), because they may induce code rot and hence
> prevent maintenance (and why not delete them to begin with?)...
>
>   
Some compilers do balk at the #if 0 code where they don't with the if 
(0) sections.
> I'm looking at the remaining cases, and have some questions:
> - should this situation be changed/cleaned up (I wouldn't want to
> spend time only to see my patches automatically refused...)?
> Are there any reasons for those #if blocks other than easier commenting?
> - if yes, is it preferable to (1) delete those sections or (2) replace
> them with "if" blocks (and delete them if they don't compile?)?
>
>   
I'm of the opinion that if the code is not needed, to remove it and add 
it back at a later time when it is fixed or additional code needed is 
added.  There should be no code in Wine that is not in use as this can 
and does cause problems, not just with builds (speed issues is one major 
thing that is pointed out time and time again.)

+1 to your review.

Thank you for helping make Wine a better MS API.

James McKenzie




More information about the wine-devel mailing list