Jump to page: 1 2
Thread overview
DMD Compiler 'switches'
Oct 12, 2015
ric maicle
Oct 12, 2015
anonymous
Oct 12, 2015
ric maicle
Oct 12, 2015
Timothee Cour
Oct 12, 2015
anonymous
Oct 12, 2015
Gary Willoughby
Oct 12, 2015
Ali Çehreli
Oct 12, 2015
ric maicle
Oct 12, 2015
Ali Çehreli
Oct 12, 2015
ric maicle
Oct 12, 2015
ric maicle
October 12, 2015
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.
October 12, 2015
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".
October 12, 2015
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.
October 12, 2015
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.
October 12, 2015
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

October 12, 2015
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.
October 12, 2015
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

October 12, 2015
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

October 12, 2015
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


October 12, 2015
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?
« First   ‹ Prev
1 2