bugGNU Octave - Bugs: bug #56596, Double plus with no space before...

 
 

bug #56596: Double plus with no space before number is legal in Matlab but not Octave

Submitter:  Richard <crobar>
Submitted:  Mon 08 Jul 2019 10:04:02 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Richard Crozier Open/Closed:  * Closed
Release:  * 5.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 09 Jul 2019 05:16:29 PM UTC, comment #1: 

Octave has prefix and postfix operators '++' and '--', which Matlab does not have. If there is no space between two consecutive '+' or '-' characters, they are parsed as the single operator '++' or '--'.

Octave recommends using space around all binary operators for readability, which in this case also semantically distinguishes the '+' operator from the '++' operator.

Mike Miller <mtmiller>
Group Member
Mon 08 Jul 2019 10:04:02 PM UTC, original submission:  

In Matlab the following is legal:


>> 1 ++1

ans =

     2.0000e+000
>> 1 + +1

ans =

     2.0000e+000
>> 1 ++ 1

ans =

     2.0000e+000


But in Octave it the first is an error:


>> 1 ++1
parse error:

  syntax error

>> 1 + + 1
ans =  2

>> 1 ++ 1
parse error:

  syntax error


I couldn't find this on the bug tracker, but it's difficult to search for. Perhaps it is known and thought not worth fixing given the simple workaround. I only discovered it in my own code due to a typo.



Richard <crobar>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by crobar (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-09 mtmiller StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code