www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DMD Compiler 'switches'

reply ric maicle <rmaicle gmail.com> writes:
I'm relearning D. I'm using the reference compiler (DMD) and I am a bit 
confused with how the compiler 'switches' are supposed to be used.

I find some 'switches' that require an equal (=) symbol when a value is 
required to be passed in.

-boundscheck=[on|safeonly|off]
-color[=on|off]
-conf=path

-debug
-debug=level
-debug=ident

But there are also 'switches' requiring a value that do not require/use 
the equal (=) symbol.

-Dddocdir
-Dffilename

-odobjdir
-offilename

I'm wondering if this small irregularity should be made consistent or 
maybe I misunderstood something.
Oct 12 2015
next sibling parent reply anonymous <anonymous example.com> writes:
On Monday 12 October 2015 17:38, ric maicle wrote:

 I'm wondering if this small irregularity should be made consistent or 
 maybe I misunderstood something.
As far as I know, the difference just happened, and there is point to it. The style without "=" is older and wasn't followed when new switches were added. Consistency between different switches has to be weighed against stability here. So far stability has won, I guess. FWIW, dmd seems to be in good company as gcc is in a similar situation. For example, `gcc -std=c11 -ofoo foo.c` is a proper gcc command line, generating the file "foo".
Oct 12 2015
next sibling parent reply ric maicle <rmaicle gmail.com> writes:
On Tuesday, 13 October, 2015 01:46 AM, anonymous wrote:
 On Monday 12 October 2015 17:38, ric maicle wrote:

 I'm wondering if this small irregularity should be made consistent or
 maybe I misunderstood something.
As far as I know, the difference just happened, and there is point to it. The style without "=" is older and wasn't followed when new switches were added. Consistency between different switches has to be weighed against stability here. So far stability has won, I guess.
I think you made it clearer now. And changing it in minor releases will break build scripts. 'Deprecating' command line switches may be an option and possibly better addressed in a major release. Also, someone may have already filed an issue about this.
Oct 12 2015
parent Timothee Cour via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
On Mon, Oct 12, 2015 at 11:33 AM, ric maicle via Digitalmars-d-learn <
digitalmars-d-learn puremagic.com> wrote:

 On Tuesday, 13 October, 2015 01:46 AM, anonymous wrote:

 On Monday 12 October 2015 17:38, ric maicle wrote:

 I'm wondering if this small irregularity should be made consistent or
 maybe I misunderstood something.
As far as I know, the difference just happened, and there is point to it. The style without "=" is older and wasn't followed when new switches were added. Consistency between different switches has to be weighed against stability here. So far stability has won, I guess.
I think you made it clearer now. And changing it in minor releases will break build scripts. 'Deprecating' command line switches may be an option and possibly better addressed in a major release. Also, someone may have already filed an issue about this.
Ya I did a while ago: "new DIP41: dmd/rdmd command line overhaul." http://forum.dlang.org/thread/mailman.1468.1369129517.4724.digitalmars-d puremagic.com
Oct 12 2015
prev sibling parent anonymous <anonymous example.com> writes:
On Monday 12 October 2015 19:46, anonymous wrote:

 and there is point to it
Ugh, should have been: and there is *no* point to it.
Oct 12 2015
prev sibling parent reply Gary Willoughby <dev nomad.so> writes:
On Monday, 12 October 2015 at 15:38:27 UTC, ric maicle wrote:
 I'm relearning D. I'm using the reference compiler (DMD) and I 
 am a bit confused with how the compiler 'switches' are supposed 
 to be used.

 I find some 'switches' that require an equal (=) symbol when a 
 value is required to be passed in.

 -boundscheck=[on|safeonly|off]
 -color[=on|off]
 -conf=path

 -debug
 -debug=level
 -debug=ident

 But there are also 'switches' requiring a value that do not 
 require/use the equal (=) symbol.

 -Dddocdir
 -Dffilename

 -odobjdir
 -offilename

 I'm wondering if this small irregularity should be made 
 consistent or maybe I misunderstood something.
Yeah, it is a bit confusing and should be tidied up (using the established deprecation path) really.
Oct 12 2015
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 10/12/2015 11:34 AM, Gary Willoughby wrote:
 On Monday, 12 October 2015 at 15:38:27 UTC, ric maicle wrote:
 -Dddocdir
 -Dffilename

 -odobjdir
 -offilename

 I'm wondering if this small irregularity should be made consistent or
 maybe I misunderstood something.
Yeah, it is a bit confusing and should be tidied up (using the established deprecation path) really.
If we accept that = cannot be a part of a file name then we could support -D=ddocdir as well, but I checked and = can be used as part of a name at least on Linux. Which may explain why those switches are not consistent with the rest and we cannot support -D= at this point. Ali
Oct 12 2015
parent reply ric maicle <rmaicle gmail.com> writes:
On Tuesday, 13 October, 2015 02:39 AM, Ali Çehreli wrote:
 If we accept that = cannot be a part of a file name then we could
 support -D=ddocdir as well, but I checked and = can be used as part of a
 name at least on Linux. Which may explain why those switches are not
 consistent with the rest and we cannot support -D= at this point.
I think I'm confused. I see the following switches using the = symbol: -config=path -debuglib=name -defaultlib=name -deps=filename
Oct 12 2015
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 10/12/2015 01:03 PM, ric maicle wrote:
 On Tuesday, 13 October, 2015 02:39 AM, Ali Çehreli wrote:
 If we accept that = cannot be a part of a file name then we could
 support -D=ddocdir as well, but I checked and = can be used as part of a
 name at least on Linux. Which may explain why those switches are not
 consistent with the rest and we cannot support -D= at this point.
I think I'm confused. I see the following switches using the = symbol: -config=path -debuglib=name -defaultlib=name -deps=filename
Perhaps those were introduced after the other ones. I am agreeing with the other posters that we cannot fix the other ones because if anyone used = before, it was the part of the path. (Maybe... Never tried... :) ) So, we cannot change the syntax today because then some users' paths will lose the = character. Ali
Oct 12 2015
parent reply ric maicle <rmaicle gmail.com> writes:
On Tuesday, 13 October, 2015 05:43 AM, Ali Çehreli wrote:
 Perhaps those were introduced after the other ones.

 I am agreeing with the other posters that we cannot fix the other ones
 because if anyone used = before, it was the part of the path. (Maybe...
 Never tried... :) ) So, we cannot change the syntax today because then
 some users' paths will lose the = character.
Would it be possible to deprecate the old syntax, provide notice to all D users and make it obsolete after a year?
Oct 12 2015
parent ric maicle <rmaicle gmail.com> writes:
On Tuesday, 13 October, 2015 06:11 AM, ric maicle wrote:
 Would it be possible to deprecate the old syntax, provide notice to
 all D users and make it obsolete after a year?
Please ignore. There is already a DIP filed regarding this matter. DIP41: dmd/rdmd command line overhaul. (http://wiki.dlang.org/DIP41)
Oct 12 2015