Compile problem ov.cc of octave-3.1.51 on cygwin
Jaroslav Hajek
highegg at gmail.com
Mon Jul 28 02:19:07 CDT 2008
On Sat, Jul 26, 2008 at 11:48 PM, Tatsuro MATSUOKA
<tmacchant at yahoo.co.jp> wrote:
> Hello Jaroslav
>
> Thank you for your reply.
>
>
> --- Jaroslav Hajek <highegg at gmail.com> wrote:
>
>> This does not occur with g++ 4.2.1. Apparently the compiler is unable
>> to convert octave_int<int32_t> to default int. I'm not sure how
>> octave_idx_type comes into play because the offending line ov.cc:1361
>> requests a conversion from int32NDArray to Array<int>.
>> Can you try to compile the following simple test in the liboctave directory?
>> test.cc:
>> #include "config.h"
>> #include "oct-inttypes.h"
>> int main()
>> {
>> int a;
>> octave_int32 b = 0;
>> a = b;
>> }
>>
>> compile with `g++ -DHAVE_CONFIG_H -I. -I../ -I ../libcruft/misc/ -c test.cc'
>>
>> In any case, I'm sure it's desirable for any octave_int32<T> instance
>> to be unambiguously convertible to default int and to octave_idx_type.
>> So if you confirm this, then unless anyone objects, I'll make a patch
>> to include the explicit conversions in octave_int32.
>
>
> Tatsu at Inspiron6000 ~/octaves/octave-3.1.51/liboctave
> $ g++ -DHAVE_CONFIG_H -I. -I../ -I ../libcruft/misc/ -c test.cc
> test.cc: In function `int main()':
> test.cc:7: error: conversion from `octave_int32' to `int' is ambiguous
> oct-inttypes.h:324: note: candidates are: octave_int<T>::operator T() const [with T = int32_t]
> oct-inttypes.h:328: note: octave_int<T>::operator double() const [with T = int32_t]
> oct-inttypes.h:330: note: octave_int<T>::operator float() const [with T = int32_t]
> test.cc:8:2: warning: no newline at end of file
>
> Perhaps your idea is right. If you will make a patch for gcc-3.4.4 on cygwin, it will be helpful
> for cygwin people.
>
> Regards
>
> Tatsuro
>
>
>
> --------------------------------------
> Power up the Internet with Yahoo! Toolbar.
> http://pr.mail.yahoo.co.jp/toolbar/
>
After a little playing around, I've decided it will be best to fix the
problem in place. See the attached patch. And anyway, this code seems
even better than the previous one: it will likely avoid a double
conversion.
Still, I kind of feel that octave_int<> instances should be implicitly
convertible to default int
(or perhaps all integer types), but I see no easy way of doing it.
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: octintexc.diff
Type: text/x-patch
Size: 2376 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080728/1d39824b/attachment.bin
More information about the Bug-octave
mailing list