Regarding compiler switches

Justin Johansson free at beer.com
Thu Nov 5 02:16:01 PST 2009


Lars T. Kyllingstad Wrote:

> 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.
> 
> -Lars

Lars, you raise a few good points about compiler switches in general.

With better --help and/or doco I would not have resorted to asking the
following question on D.learn.

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=18101

The impetus for my particular post was a quandary I had about why asserts were
being fired in my D program when the -release option was specified on the
command line.  Upon some kind person replying on D.learn I revisited my
command line only to realise I had -unittest flicked on as well as -release.

If you read that thread you will see my final response.

beers,
Justin

btw. beers comes about because of an almost typo on 'cheers' for an NG posting
but since I now kind of like it -- and I'd be happy to buy you a cheer -- I'm thinking
of making my D NG signature beerophile but the USPTO might rule this as being
too close to another name already in use in this community :-)

ciao, beerophile




More information about the Digitalmars-d mailing list