octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #51871] loading '-ascii' format files is slow
Date: Fri, 8 Sep 2017 18:06:27 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0

Follow-up Comment #30, bug #51871 (project octave):

Actually, in this reference it sounds like 'fail' is set when there is an
EOF:

http://www.cplusplus.com/reference/istream/istream/get/

"
The first signature returns the character read, or the end-of-file value (EOF)
if no characters are available in the stream (note that in this case, the
failbit flag is also set).
"

Looking at this a little more closely, I'm wondering if the tests for validity
should be moved sooner in octave_read_fp_value(), right after reading rather
than after processing the character.

What led me to the above link is that I was wondering what is returned by
is.get() when there is a failure.  Take a look at this current construct:


  char c1 = ' ';

  while (isspace (c1))
    c1 = is.get ();


There is no checking of valid read in this while loop, so I was wondering what
happens if there is an I/O failure.  Will c1 get updated to something other
than ' '?  If not, this will be an infinite loop.  From the documentation, it
sounds like c1 is the EOF character when EOF is found, but what about other
scenarios of bad/fail bits on the initial try?

And if there are failures, it seems likely that in the switch command that
is.putback(c1) could get called.  If there were errors, it might be
compounding things to do a stream operation on "is" if it is in a fragile
state, i.e., maybe it would create a type of error different from the original
error.

Anyway, for certain the EOF should be checked, so I'm updating the patch.

(file #41768)
    _______________________________________________________

Additional Item Attachment:

File name: octave-check_bad_and_eof_bit-djs2017sep08.patch Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51871>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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