[Mono-devel-list] Re: System.XML warning

Marek Safar marek.safar at seznam.cz
Thu Mar 17 11:30:02 EST 2005


Hello,

>>Marek, while we are adding new compiler warnings, can
>>we have some way to "hide" the warnings on an
>>individual symbol basis?  It seems to me that our goal
>>should be to get rid of all warnings one way or
>>another.  If the warning is coming up because we
>>haven't used a function we know we will use later,
>>it'd be nice to attach an attribute to that function,
>>for instance, that tells our compiler not to show a
>>warning when this function is private and unused.  If,
>>on the other hand, we messed up and just ended up
>>having a private symbol that we wont use, it'd be nice
>>to get a message on that one.
>>
>>    
>>
>mcs supports the C# 2 pragma stuff to disable/restore warnings
>on a given section of code. (It is possible this is not in the 1.0.X
>branch yet, I didn't check)
>
>You can do it like this:
>#pragma warning disable 0169
>string bar;
>#pragma warning restore 0169
>  
>
Yes, you can use this syntax with 1.1.x mcs and csc 2.0.
But I don't recommend it, when you have private field, method, .. and 
they are never used.
Why they are there ? It only confuses other developers. When this method 
is "too early" implementation of some a new feature,
which I think is very rare why not simply comment this code either using 
#if or as ordinary comment
I guess, the rest should be deleted.

Marek





More information about the Mono-devel-list mailing list