lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 3925: lilypond -d leads to weird output (issue 104720047)


From: dak
Subject: Re: Issue 3925: lilypond -d leads to weird output (issue 104720047)
Date: Sun, 01 Jun 2014 16:23:30 +0000

Reviewers: lemzwerg,

Message:
On 2014/06/01 16:00:24, lemzwerg wrote:
Mhmm, having quotes like

   `-foo', `--bar'     ,

or maybe

   '-foo', '--bar'     ,

to follow the latest GNU coding standard, is the correct way IMHO -
the comma is
definitely *not* part of the expression.

The Usage reference states

Basic command line options for LilyPond
---------------------------------------

The following options are supported:

'-d, --define-default=VAR=VAL'
     See *note Advanced command line options for LilyPond::.

'-e, --evaluate=EXPR'
[...]

and I don't see the point in diverging from this.  lilypond --help says

Options:
  -d, --define-default=SYM[=VAL]      set Scheme option SYM to VAL
(default: #t).
                                        Use -dhelp for help.
  -e, --evaluate=EXPR                 evaluate scheme code

without quotes at all, instead using formatting.  Arguably, `-d, --...'
are also formatted as one itentity here.

Description:
Issue 3925: lilypond -d leads to weird output

C++ string manipulation is a fragile bolt-on onto the type system.

"-" + 'd'

evaluates to a pointer 100 bytes after a constant string "-" in the data
section.  This fixes this bug, and also changes the fixed message from

    lilypond: option `-d, `--define-default'' requires an argument

to

    lilypond: option `-d, --define-default' requires an argument

In general, it does not appear to make sense quoting the long options
while not quoting the short options.

Please review this at https://codereview.appspot.com/104720047/

Affected files (+2, -2 lines):
  M flower/getopt-long.cc


Index: flower/getopt-long.cc
diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc
index 458c2374cafb97f785b086c74e10127b6b5ce8ea..0d6da2c60e5e9c036c615e321173d0c765679142 100644
--- a/flower/getopt-long.cc
+++ b/flower/getopt-long.cc
@@ -103,11 +103,11 @@ Long_option_init::to_string () const
 {
   string str;
   if (shortname_char_)
-    str += "-" + shortname_char_;
+    str += string ("-") + shortname_char_;
   if (shortname_char_ && longname_str0_)
     str += ", ";
   if (longname_str0_)
-    str += string ("`--") + longname_str0_ + "'";
+    str += string ("--") + longname_str0_;
   return str;
 }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]