Regarding compiler switches

div0 div0 at users.sourceforge.net
Thu Nov 5 15:35:14 PST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nick Sabalausky wrote:
> "Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote in message 
> news:hcu5bc$at8$1 at digitalmars.com...
>> DMD has just a few switches that control how code is compiled, such 
>> as -safe, -release, -O and so on. In comparison, GCC has (and this is just 
>> a rough estimate) a gazillion switches. For the most part, DMD's simpler 
>> approach is a good thing, because it makes the compiler easy to use.
>>
>> However, from time to time, discussions appear on this NG that indicate 
>> not everyone is happy with the situation. For instance, people have 
>> complained that it's not possible to separately turn on/off bounds 
>> checking and compilation of contracts.
>>
>> Recently there was a discussion of whether the -safe switch should affect 
>> array bounds checking too. I don't think any agreement was reached.
>>
>> Is there any good reason for NOT letting people choose these things for 
>> themselves? I suspect it would be very easy to add more detailed options 
>> to DMD:
>>
>>   --bounds-checking=on|off
>>   --mem-safe=on|off
>>   --Oxxx=on|off|auto  (There are many possible optimisations, and the
>>                       compiler doesn't always know best.)
>>   --contracts=on|off
>>
>> Note that I think it's important that -release & co. are kept, but they 
>> should be defined as common combinations of the more detailed options.
>>
> 
> Sounds like a good time to nag again about the idea of a "treat warnings as 
> warnings" option:
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=2567
> 
> A patch is even there that adds "-ww" as an alternative to "-w" that enables 
> warnings, but actually treats them as warnings. I *really* hate that DMD 
> doesn't currently offer an ability to enable warnings without treating them 
> as errors, because the current way amounts to nothing more than "optional 
> errors", which effectively splits D into two different languages (and those 
> two languages are a slightly less helpful one, and a somewhat naggy one, but 
> the option to treat warnings as warnings would merge them back into the same 
> language while maintaining the best of both).
> 
> 

NO. NO. NO. NO! NO. NO. NO. NO! NO. NO. NO. NO! NO. NO. NO. NO!

N   N  NNN   NNN
NN  N N   N  NNN
N N N N   N  NNN
N  NN N   N
N   N  NNN    N

That is an amazingly shit idea.
Have you *ever* tried to write portable c++ code???

It's utterly impossible without prefixing and postfixing *every* single
header filer with the following shit:

====================

/** my wanky library */

#include "disableWarningsForThisShittyCompiler.h"

...
/*** stuff in my library that doesn't make clients want to
eat their own fists and hunt me down and rape me with a bronze
casting of a pinapple. **/
...

#include "reenableWarningsIDisabledSoImNotAMassiveCockToClients.h"

====================

I've never come across one single *useable* c or c++ library that
doesn't not follow the above pattern.

And don't give me that shit about command line options.
That simply doesn't work. As a library implementor you have no control
over that so you simply *have* to use *compiler* specific pragmas on
every single bloody *compiler*.

Warnings are BAD language design, nothing more.

If you want warnings that are not errors, you need to write yourself a
LINT style tool to run after you compile and lump it in with your test
harness so they can be reviewed on a semi regular basis instead of
annoying the shit out of you on every single compile.

I've only had the misfortune to shepard code through 3 generations of
Microsoft compiler and even with confining code to the compiler of 1
implementer it's a *massive* pain in the arse.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFK82EyT9LetA9XoXwRAnLpAJoDEWlr/DuLh8e+ZsGCbjW6CVsR2QCeLzoX
FT2qowHpKoBHKpvkOwZkHt0=
=SiXu
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list