View mode: basic / threaded / horizontal-split · Log in · Help
October 22, 2012
dmd -run and command line argument order
I just noticed this slightly odd behaviour from dmd -run and wondered if  
it's a "bug"?

[vertest.d]
import std.stdio;

void main()
{
  version(TEST) writefln("TEST");
}

If we compile without -run we get consistent/expected behaviour from  
-version:
  C:\TEMP>dmd vertest.d -version=TEST
  C:\TEMP>vertest
  TEST

  C:\TEMP>dmd -version=TEST vertest.d
  C:\TEMP>vertest
  TEST

But, if we use -run...
  C:\TEMP>dmd -run vertest.d -version=TEST  <- weird, outputs nothing

  C:\TEMP>dmd -version=TEST -run vertest.d
  TEST

Basically it looks like -run ignores any arguments that follow it..

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
October 22, 2012
Re: dmd -run and command line argument order
It does not ignore, it passes them as an arguments to resulting 
program.

On Monday, 22 October 2012 at 12:36:44 UTC, Regan Heath wrote:
> I just noticed this slightly odd behaviour from dmd -run and 
> wondered if it's a "bug"?
>
> [vertest.d]
> import std.stdio;
>
> void main()
> {
>   version(TEST) writefln("TEST");
> }
>
> If we compile without -run we get consistent/expected behaviour 
> from -version:
>   C:\TEMP>dmd vertest.d -version=TEST
>   C:\TEMP>vertest
>   TEST
>
>   C:\TEMP>dmd -version=TEST vertest.d
>   C:\TEMP>vertest
>   TEST
>
> But, if we use -run...
>   C:\TEMP>dmd -run vertest.d -version=TEST  <- weird, outputs 
> nothing
>
>   C:\TEMP>dmd -version=TEST -run vertest.d
>   TEST
>
> Basically it looks like -run ignores any arguments that follow 
> it..
>
> R
October 22, 2012
Re: dmd -run and command line argument order
On Mon, 22 Oct 2012 14:08:22 +0100, mist <none@none.none> wrote:
> It does not ignore, it passes them as an arguments to resulting program.

Ahh, of course.  :p

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
Top | Discussion index | About this forum | D home