[changeset] uninitialized value bug in strncmp

Thorsten Meyer thorsten.meyier at gmx.de
Thu Jan 1 06:20:18 CST 2009


Hi,

here is a patch (against mercurial) for the following bug in strncmp:

comparing a string with a cell array, the return value for non-character cells is random:

octave:1> strncmp("abc", {"abcd", 10}, 2)
ans =

     1   164

octave:2>
octave:2> strncmp("abc", {"abcd", 10}, 2)
ans =

     1   191

octave:3> strncmp("abc", {"abcd", 10}, 2)
ans =

     1   184

octave:4> strncmp("abc", {"abcd", 10}, 2)
ans =

     1   138

The reason is that in this particular case, the output value is left uninitialized.

regards

Thorsten



More information about the Bug-octave mailing list