octave-maintainers
[Top][All Lists]
Advanced

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

scalar octave value for char?


From: Rik
Subject: scalar octave value for char?
Date: Fri, 26 Sep 2014 22:22:01 -0700

9/26/14

jwe,

I keep uncovering more stuff from the max.cc code.  Currently there is no
line coverage for

template <>
octave_value
do_minmax_bin_op<charNDArray> (const octave_value& argx,
                               const octave_value& argy, bool ismin)

for the cases of a mixed array/scalar or scalar/array.  An example is max
("abc", "b").  The code in question is

if (argx.is_scalar_type () == 1)

This always returns false--even when isscalar() returns true.  This happens
because the function isscalar checks that numel == 1, whereas
is_scalar_type is a virtual function from ov.h which returns false, but is
overriden in scalar classes to return true.

The problem is that there is no octave value class for scalar char.  The
only relevant files in the octave-value directory are ov-ch-mat.[h|cc].  By
contrast, for logical octave values there is ov-bool.[h|cc] and
ov-bool-mat.[h|cc].  Do we need to create the ov-ch.[h|cc] files?

I tried hacking the if conditional to

if (argx.numel () == 1)

This allows the code to run a bit further before it gets to a segfault with

char x = octave_value_extract<char> (argx);

So, I don't think that is the right track.  Any thoughts where to go with this?

--Rik




reply via email to

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