bugGNU Octave - Bugs: bug #52644, fopen warning for 'capital modes'...

 
 

bug #52644: fopen warning for 'capital modes' could be replaced with just documentation

Submitter:  kire pudsje <kpc>
Submitted:  Mon 11 Dec 2017 11:20:18 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Kire Pudsje Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 15 Dec 2017 08:52:43 PM UTC, comment #2: 

I changed the documentation on the stable branch in this cset http://hg.savannah.gnu.org/hgweb/octave/rev/d400b09043dd.  Because I didn't want to change behavior on the stable branch (wouldn't be stable if I did) I removed the warnings on the development branch which will eventually become version 4.4.0.  See cset http://hg.savannah.gnu.org/hgweb/octave/rev/c23b9af6a664.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Tue 12 Dec 2017 12:36:59 AM UTC, comment #1: 

By default, Octave is not setting the stream parameter std::ios::unitbuf which means that streams should get the default which is buffered output.  This should be a performance win.

I think it would be useful to have someone test whether 'W' or 'w' still make a difference in Matlab.  It certainly looks like the distinction is still present given their documentation: http://www.mathworks.com/help/matlab/ref/fopen.html#inputarg_permission.

I think you're right that a note in the documentation about the deliberate incompatibility would be useful here.

One of the few places where I could see the automatic flushing being useful would be real-time control of an instrument or robot that is occurring through a file-based mechanism (including a pipe).  In that case, rather than having to use fflush() after every command, it would make sense to just open the command channel with auto-flush.

Rik <rik5>
Group administrator
Mon 11 Dec 2017 11:20:18 PM UTC, original submission:  

I ported some old Matlab scripts, then came across this warning


>> fd=fopen('test.bin', 'Wb')
warning: fopen: treating mode "W" as equivalent to "w"


The capital letters in the modes provided a huge improvement in write performance when working with Matlab by not flushing (I do not know about current Matlab versions). As can also be read on this site:
https://undocumentedmatlab.com/blog/improving-fwrite-performance
In the Octave source code there is also a remark about not knowing where the capital letter modes are for (file-io.cc:142).

This warning can IMHO be removed.
Actually, to be correct, a warning should have been placed at the lower case modes. But please do NOT do that.
On the other hand, a remark about the flushing/non-flushing difference between Matlab and Octave in the help-page could be helpful.

kire pudsje <kpc>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by kpc (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-15 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-12-12 rik5 StatusNone Confirmed
        Summaryremove fopen warning for 'capital modes' fopen warning for 'capital modes' could be replaced with just documentation

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code