www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 423] New: dmd ignores empty commandline arguments

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=423

           Summary: dmd ignores empty commandline arguments
           Product: D
           Version: 0.169
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


dmd "" a.d
is interpreted as >dmd a.d<

dmd ''
is interpteted as >dmd<


-- 
Oct 09 2006
next sibling parent reply Walter Bright <newshound digitalmars.com> writes:
d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=423
 
            Summary: dmd ignores empty commandline arguments
            Product: D
            Version: 0.169
           Platform: PC
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: thomas-dloop kuehne.cn
 
 
 dmd "" a.d
 is interpreted as >dmd a.d<
 
 dmd ''
 is interpteted as >dmd<

That's what it's supposed to do.
Oct 10 2006
parent reply Derek Parnell <derek psyc.ward> writes:
On Tue, 10 Oct 2006 01:39:01 -0700, Walter Bright wrote:

 d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=423
 
            Summary: dmd ignores empty commandline arguments
            Product: D
            Version: 0.169
           Platform: PC
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: thomas-dloop kuehne.cn
 
 dmd "" a.d
 is interpreted as >dmd a.d<
 
 dmd ''
 is interpteted as >dmd<

That's what it's supposed to do.

Why? I would have expected a string of length zero to be passed. -- Derek Parnell Melbourne, Australia "Down with mediocrity!"
Oct 10 2006
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Derek Parnell wrote:
 On Tue, 10 Oct 2006 01:39:01 -0700, Walter Bright wrote:
 
 d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=423

            Summary: dmd ignores empty commandline arguments
            Product: D
            Version: 0.169
           Platform: PC
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: thomas-dloop kuehne.cn

 dmd "" a.d
 is interpreted as >dmd a.d<

 dmd ''
 is interpteted as >dmd<


Why? I would have expected a string of length zero to be passed.

So? It's zero-length string is "nothing", hence ignored.
Oct 10 2006
parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Tue, 10 Oct 2006 16:47:34 -0600, Hasan Aljudy wrote:

 Derek Parnell wrote:
 On Tue, 10 Oct 2006 01:39:01 -0700, Walter Bright wrote:
 
 d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=423

            Summary: dmd ignores empty commandline arguments
            Product: D
            Version: 0.169
           Platform: PC
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: thomas-dloop kuehne.cn

 dmd "" a.d
 is interpreted as >dmd a.d<

 dmd ''
 is interpteted as >dmd<


Why? I would have expected a string of length zero to be passed.

So? It's zero-length string is "nothing", hence ignored.

Huh? If I hold a cup of coffee, then drink it all, do I still hold nothing or a cup of nothing? A string is a container that holds zero or more characters, IMHO. An empty string is still a string, it just has no characters in it. Consider a blank sheet of paper; is it full of 'space' characters or does it contain nothing? Is it still a page if it has no characters in it? Consider an array of text lines; if one or more of them are empty, do we ignore those when printing on a page or do we use that information? The strings on a command line contain information even if one of them is empty - at the very least it is a placeholder. An empty string is different from a string that is not initialized and different again from non-existent 'string'. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 11/10/2006 9:07:12 AM
Oct 10 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Derek Parnell wrote:
 The strings on a command line contain information even if one of them is
 empty - at the very least it is a placeholder. 

We could argue this till the cows come home. But the current behavior: 1) Is a result of the Digital Mars C startup code 2) It's been that way for 20+ years 3) It's embedded into every DM tool and every command line program created with DM Nobody has ever complained about it or even commented on it before. I doubt anyone has noticed it - I certainly haven't, and I've used this stuff probably more than anyone <g>. Linux, however, does behave the way you suggest - at least the default shell I use does it that way. On the other hand, I've never seen any linux utility that made any mention in its documentation about having any meaning assigned to blank arguments. Trying it on a few just gives errors. In other words, I don't think it's worth arguing about or changing.
Oct 10 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Bright schrieb am 2006-10-11:
 Derek Parnell wrote:
 The strings on a command line contain information even if one of them is
 empty - at the very least it is a placeholder. 

We could argue this till the cows come home. But the current behavior: 1) Is a result of the Digital Mars C startup code 2) It's been that way for 20+ years 3) It's embedded into every DM tool and every command line program created with DM

Please document this behaviour(http://www.digitalmars.com/d/dcompiler.html).
 Nobody has ever complained about it or even commented on it before. I 
 doubt anyone has noticed it - I certainly haven't, and I've used this 
 stuff probably more than anyone <g>.

 Linux, however, does behave the way you suggest - at least the default 
 shell I use does it that way. On the other hand, I've never seen any 
 linux utility that made any mention in its documentation about having 
 any meaning assigned to blank arguments. Trying it on a few just gives 
 errors.

 In other words, I don't think it's worth arguing about or changing.

The Linux Way is very nice for locating scripting bugs: dmd "${SOURCE_1}" "${SPURCE_2}" Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFLWIVLK5blCcjpWoRApSxAJoCdkJ/hpeJxrjvNm9NN8uzTGtLAQCgno4+ o6BocvVDeMNBUHHK3YeXrZA= =abZh -----END PGP SIGNATURE-----
Oct 11 2006
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Thomas Kuehne wrote:
 The Linux Way is very nice for locating scripting bugs:
 
 dmd "${SOURCE_1}" "${SPURCE_2}"
 
 Thomas
 

Hmm, so does it have anything to do with a bug in dbuild, Derek?
Oct 12 2006
parent Derek Parnell <derek psyc.ward> writes:
On Thu, 12 Oct 2006 12:58:56 -0600, Hasan Aljudy wrote:

 Thomas Kuehne wrote:
 The Linux Way is very nice for locating scripting bugs:
 
 dmd "${SOURCE_1}" "${SPURCE_2}"
 
 Thomas
 

Hmm, so does it have anything to do with a bug in dbuild, Derek?

Huh? Does 'what' have anything to do with dbuild? The topic is about dmd not acknowledging an empty commandline argument. The dbuild utility, having been compiled by dmd, inherits Walter's view of what is correct commandline parsing and it just gets whatever dmd takes out of the command line. So the short answer is *no*. -- Derek Parnell Melbourne, Australia "Down with mediocrity!"
Oct 12 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=423





------- Comment #4 from bugzilla digitalmars.com  2008-06-25 18:54 -------
I'll add a note to dcompiler.html


-- 
Jun 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=423


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #5 from bugzilla digitalmars.com  2008-07-09 22:32 -------
Fixed dmd 1.032 and 2.016


-- 
Jul 09 2008