MSVC compilation fixes

View: New views
6 Messages — Rating Filter:   Alert me  

MSVC compilation fixes

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please consider the following patch for inclusion

http://hg.tw-math.de/octave-graphics-mq/rev/a15e56860500

It fixes various compile problem and/or typos that makes it
compile with MSVC. Note that the changes related to the
"pow" function should be reviewed, as I'm not sure if my
modifications are correct.

Michael.

MSVC compilation fixes

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 20-Jun-2008, Michael Goffioul wrote:

| Please consider the following patch for inclusion
|
| http://hg.tw-math.de/octave-graphics-mq/rev/a15e56860500
|
| It fixes various compile problem and/or typos that makes it
| compile with MSVC. Note that the changes related to the
| "pow" function should be reviewed, as I'm not sure if my
| modifications are correct.

diff -r 7683fa6c06a2 src/OPERATORS/op-int.h
--- a/src/OPERATORS/op-int.h Mon Feb 11 10:11:56 2008 +0100
+++ b/src/OPERATORS/op-int.h Fri Jun 20 12:40:27 2008 +0200
@@ -227,13 +227,13 @@
   octave_value \
   xpow (const octave_ ## T1& a, float b) \
   { \
-    return pow (a, b); \
+    return pow (a, static_cast<double> (b)); \
   } \

Shouldn't we use powf here instead?  Does MSVC provide powf, or do we
need a replacement in lo-specfun.cc (or lo-mappers.cc; I'm not sure
now why these files aren't combined)?

jwe

Re: MSVC compilation fixes

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 9, 2008 at 5:10 PM, John W. Eaton <jwe@...> wrote:

> diff -r 7683fa6c06a2 src/OPERATORS/op-int.h
> --- a/src/OPERATORS/op-int.h    Mon Feb 11 10:11:56 2008 +0100
> +++ b/src/OPERATORS/op-int.h    Fri Jun 20 12:40:27 2008 +0200
> @@ -227,13 +227,13 @@
>   octave_value \
>   xpow (const octave_ ## T1& a, float b) \
>   { \
> -    return pow (a, b); \
> +    return pow (a, static_cast<double> (b)); \
>   } \
>
> Shouldn't we use powf here instead?  Does MSVC provide powf, or do we
> need a replacement in lo-specfun.cc (or lo-mappers.cc; I'm not sure
> now why these files aren't combined)?

Maybe David should comment on it. MSVC has powf
(but it simply defined to (float)pow(a,b) on non-64bits architectures)).

Michael.

Re: MSVC compilation fixes

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Goffioul wrote:

> On Wed, Jul 9, 2008 at 5:10 PM, John W. Eaton <jwe@...> wrote:
>  
>> diff -r 7683fa6c06a2 src/OPERATORS/op-int.h
>> --- a/src/OPERATORS/op-int.h    Mon Feb 11 10:11:56 2008 +0100
>> +++ b/src/OPERATORS/op-int.h    Fri Jun 20 12:40:27 2008 +0200
>> @@ -227,13 +227,13 @@
>>   octave_value \
>>   xpow (const octave_ ## T1& a, float b) \
>>   { \
>> -    return pow (a, b); \
>> +    return pow (a, static_cast<double> (b)); \
>>   } \
>>
>> Shouldn't we use powf here instead?  Does MSVC provide powf, or do we
>> need a replacement in lo-specfun.cc (or lo-mappers.cc; I'm not sure
>> now why these files aren't combined)?
>>    
>
> Maybe David should comment on it. MSVC has powf
> (but it simply defined to (float)pow(a,b) on non-64bits architectures)).
>
> Michael.
>
>  
I'd say use powf.. If I didn't it was just an oversight..

D.

--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary


Re: MSVC compilation fixes

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 10, 2008 at 1:56 PM, David Bateman
<David.Bateman@...> wrote:
> I'd say use powf.. If I didn't it was just an oversight..

OK. I updated the corresponding patch in the graphics patch queue.

Michael.

Re: MSVC compilation fixes

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10-Jul-2008, Michael Goffioul wrote:

| On Thu, Jul 10, 2008 at 1:56 PM, David Bateman
| <David.Bateman@...> wrote:
| > I'd say use powf.. If I didn't it was just an oversight..
|
| OK. I updated the corresponding patch in the graphics patch queue.

I applied it to my archive.

Thanks,

jwe
LightInTheBox - Buy quality products at wholesale price