Is this reasonable?

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 6 03:56:21 PST 2013


On Friday, December 06, 2013 12:02:29 Fra wrote:
> On Friday, 6 December 2013 at 02:11:20 UTC, Jonathan M Davis
> 
> wrote:
> > Regardless, we're pretty much stuck at this point. Changing it
> > would silently
> > break lots of code.
> 
> I still wonder what was the reasoning behind C's warning about
> comparison between signed and unsigned integers instead of giving
> an error.
> 
> And as much as I do understand the "no warnings policy", I really
> think that if you keep features from C, you should also keep C
> warnings.
> (BTW: I was quite sure dmd warned the user, maybe it was GDC or
> LDC instead?)

An error is something defined by the language, whereas warnings are completely 
compiler-specific. As warning about comparing signed and unsigned integers is a 
warning, it's not standard, and the decision to warn about it or not is a 
matter of what the devs of a particular compiler decided to do.

There's no such thing as standard warnins in C. What gets warned about depends 
entirely on the compiler and what it's settings are. For instance, gcc doesn't 
warn about comparing signed and unsigned values (at least not by default), 
whereas Visual Studio does. So, trying to follow what C does with regards to 
warnings doesn't make sense, because it varies from compiler to compiler. Each 
case should be decided on its own merits and not because of what a particular 
C compiler happens to do.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list