Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #12096

Re: Type cast issue, never seen before

From Martin <Martin@spam.spam>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Type cast issue, never seen before
Date 2018-10-31 10:16 +0000
Organization A noiseless patient Spider
Message-ID <prbvdu$ddl$1@dont-email.me> (permalink)
References <poa8dm$q8k$1@dont-email.me> <c504e135-cca0-41a8-a63a-1f51a6c41b01@googlegroups.com>

Show all headers | View raw


Thank you Robert

We fixed it by making sure the C can handle the float!

Martin

On 24/09/2018 10:37, Robert van der Hulst wrote:
> Martin,
> 
> You should not use _CAST here. If you want to convert a float to a dword use the  following syntax
> 
> dwValue := DWORD(floatValue)
> 
> The _CAST tells the compiler that you know what you are doing and that you do not want the compiler to tell you that you are doing that you should not do.
> In this case you obviously don't know that. If you write
> 
> dwValue := DWORD(_CAST, floatValue)
> 
> then you are assigning the address of the float (float is a dynamic type in VO) to the DWORD variable.
> 
> As a general rule of thumb I would say that if your app does not do what you expect it to do, then first have a look at the places where you are using _CAST.
> 
> 
> Robert
> 
> 
> Robert
> 
>> Hello All
>>
>> I am casting a float to a DWORD before sending it off to a C routine
>>
>> nNew := DWORD(_CAST,nOld)
>>
>> nOld is 983.0000
>> nNew is a random number generated by DWORD
>>
>> 983.00   511849756
>> 983.00   512025408
>> 983.00   512137148
>> 983.00   512317164
>>
>>
>> Anyone have any ideas?
> 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Type cast issue, never seen before Martin <Martin@spam.spam> - 2018-09-24 09:48 +0100
  Re: Type cast issue, never seen before Robert van der Hulst <rjvanderhulst@gmail.com> - 2018-09-24 02:37 -0700
    Re: Type cast issue, never seen before Martin <Martin@spam.spam> - 2018-10-31 10:16 +0000

csiph-web