Menu

#2442 continuation character "\" at end of comment lines not handled correctly

None
closed-invalid
nobody
None
2021-06-02
2021-05-05
No

Gnuplot does not handle "\" continuation character at end of comment lines correctly.
Tested on Ubuntu 20.10 with gnuplot 5.2 patchlevel 8

replot
^
"demo2.plot" line 8: no previous plot

...simple example below. Remove the trailing "\" in the comment line to make it work.

a = 0.9
f(x) = a * sin(x)
g(x) = a * cos(x)

#plot f(x) title 'sin(x)' with lines linestyle 1, \
plot f(x) title 'sin(x)' with lines linestyle 1, \
     g(x) notitle with lines linestyle 2
replot
pause -1

Discussion

  • Hans-Bernhard Broeker

    • status: open --> pending-invalid
    • Group: -->
    • Priority: -->
     
  • Hans-Bernhard Broeker

    Your expectation of what "correct behaviour" would be in this case is unjustified.

     
  • internationils

    internationils - 2021-05-05

    https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_03
    ...see rule 10, that was essentially my expectation - "If the current character is a '#', it and all subsequent characters up to, but excluding, the next <newline> shall be discarded as a comment. The <newline> that ends the line is not considered part of the comment."
    I had assumed this functionality since you are using shell-style comments. Else please point me to something that would justify the "correct behaviour" so I can understand where I went wrong and don't make wrong assumptions. Thanks!

     

    Last edit: internationils 2021-05-05
    • Ethan Merritt

      Ethan Merritt - 2021-05-05

      Here is the section from gnuplot documentation:

      gnuplot> help comments
      
       The comment character `#` may appear almost anywhere in a command line, and
       `gnuplot` will ignore the rest of that line. A `#` does not have this effect
       inside a quoted string. Note that if a commented line ends in '\' then the
       subsequent line is also treated as part of the comment.
      
       

      Last edit: Ethan Merritt 2021-05-05
  • Ethan Merritt

    Ethan Merritt - 2021-06-02
    • status: pending-invalid --> closed-invalid
     

Log in to post a comment.

MongoDB Logo MongoDB