octave-maintainers
[Top][All Lists]
Advanced

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

Octave gets it right, Matlab gets it wrong, but wait ...


From: John W. Eaton
Subject: Octave gets it right, Matlab gets it wrong, but wait ...
Date: Thu, 17 Jan 2008 14:51:32 -0500

On 17-Jan-2008, Tom Holroyd wrote:

| OK, I greatly enjoyed debugging something recently where I found that
| Octave 3.0 did the right thing and Matlab was doing it wrong.
| Specifically, with recent Matlab,
| 
|     x = fread(fid, 32, 'char')';
| 
| reads 64 bytes. In my code, I it changed to:
| 
|     x = fread(fid, 32, 'uchar')';
| 
| and this read 32 bytes in both Octave 3.0 and Matlab 7.2. For more, see
| 
| http://www.mathworks.com/support/solutions/data/1-2782ZU.html?
| solution=1-2782ZU
| 
| The issue is that 'char' is a 16 bit quantity in newer Matlab.
| 
| I really hate that they have made this change. It breaks existing code.
| 
| What will Octave do? I can see the point that you need a wide type to
| handle Unicode, but I don't think that changing the definition of 'char'
| is the right way to do it.
| 
| Is Octave going to track this sort of stupidity?

Take your 7-bit-ASCII-centric attitude somewhere else, buddy.

Seriously, I can see handling char as 16-bits, but in that case, I
think I would also expect uchar to be the same width.  Perhaps you
should change uchar above to be uint8 instead (with an explicit char
conversion around it, if needed), if you want to read 8-bit
characters?  Oh, but that is ugly.

I guess the Japanese must be paying the big money.

jwe


reply via email to

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