[Mono-dev] CS0019 for value type != null
Casey Marshall
cmarshall at pacificbiosciences.com
Tue Apr 8 14:52:46 EDT 2008
On Tue, 2008-04-08 at 12:53 +0100, Marek Safar wrote:
> Hello Andrés,
> > Marek Safar wrote:
> >
> >> Hello Casey,
> >>
> >>> I've noticed that on a recent SVN build of mono, I get a CS0019 error if
> >>> I try to compare a value type against null. E.g.:
> >>>
> >>> DateTime dt;
> >>> if (dt != null)
> >>> Console.WriteLine(dt);
> >>>
> >>> As far as I can tell, this is the correct behavior, since a value type
> >>> can't be null. I'm concerned, though, because this behavior seems to
> >>> have been introduced recently in SVN, AND it looks like MS's compiler
> >>> doesn't reject this statement (well, I haven't seen it accept it, but
> >>> this is existing code which apparently compiles fine under Visual
> >>> Studio).
> >>>
> >>>
> >> This code compiles correctly with the SVN HEAD version.
> >>
> >
> > IIRC this was a design flaw that some mono devs didn't agree about,
> > right? Is gmcs compiler at least reporting a warning about this? If not,
> > it would be interesting to do so although MS doesn't do it (in the past
> > I remember fixing some bugs in a MS.NET project because gmcs reported
> > more warnings than csc!).
> >
> Yes, gmcs does report a warning in this case.
>
Aha, OK. I'll update and warn the devs here.
More information about the Mono-devel-list
mailing list