That is strange. It looks like the server change escape sequences in text, even though they aren't intended to be escape sequences.
I was referring to the double backslash as a means of integer division. That would be "\ \" without the space in between.
That looked so strange when I opened the email and know that's not exactly what I wrote.
W.
-----Original Message-----
From: Edwards, Waverly [mailto:Waverly.Edwards@...]
Sent: Wednesday, October 07, 2009 4:10 PM
To: futurebasic@...
Subject: RE: [FB] warning of an incompatible assignment
>>
A temporary assigment is often the only way around the warnings. I
prefer to confine such workarounds to small utility functions, so that
your working code isn't cluttered.
<<
Ultimately, that is what I did to silence the problem. I've had a few instances
where it warning ended up being a catastrophic error, so I don't live with them
I make sure they don't exist.
<<
Lastly, your size calculation was:
> end fn = fn GetHandleSize( h ) \ sizeof ( testRec )
Here '\' forces a floating point division. Use '/' instead.
<<
Great catch. I should read the docs. I forgot about the \, vs /, vs \.
I'll see if \ still forces integer division. I very likely wont remember
that \ is floating point division and wonder why my programs don't work as
expected but I'll remember \ because I was accustom to using it.
Thanks,
W.
-----Original Message-----
From: Robert Purves [mailto:listrp@...]
Sent: Wednesday, October 07, 2009 3:04 PM
To: futurebasic@...
Subject: Re: [FB] warning of an incompatible assignment
Waverly wrote:
> I've been getting warning about incompatible assignment when I
> attempt to do the following.
[snip]
The actual warning from gcc is like this:
warning: passing argument 1 of 'GetHandleSize' from incompatible
pointer type
Clang gives a more precise diagnosis:
warning: incompatible pointer types passing 'TestRec **', expected
'Handle' (aka 'Ptr *')
return GetHandleSize( h ) / sizeof( TestRec );
^
The warnings are harmless, but certainly undesirable.
> I could be wrong but wouldn't a cast of testHandle in strategic
> locations resolve this issue
Yes, but there's no way to express a cast in FB.
> OK, the core question. Should I continue to make temporary
> assignments such as this or should I look to the compiler to make
> the necessary adjustments? I realize the compiler cant read my mind
> but I wonder if this is a case the FB compiler, (not GCC) could have
> resolved.
A temporary assigment is often the only way around the warnings. I
prefer to confine such workarounds to small utility functions, so that
your working code isn't cluttered.
/*
Prevent gcc warning:
passing argument 1 of 'GetHandleSize' from incompatible pointer type
*/
local fn GetHandleSize_Wrapper( anyTypeHandle as ptr ) as UInt32
'~'1
dim as Handle h
h = anyTypeHandle
end fn = fn GetHandleSize( h )
/*
Prevent gcc warning:
passing argument 1 of 'DisposeHandle' from incompatible pointer type
*/
local fn DisposeHandle_Wrapper( anyTypeHandle as ptr )
'~'1
dim as Handle h
h = anyTypeHandle
DisposeHandle( h )
end fn
/*
Prevent gcc warning:
passing argument 1 of 'SetHandleSize' from incompatible pointer type
*/
local fn SetHandleSize_Wrapper( anyTypeHandle as ptr, size as long )
'~'1
dim as Handle h
h = anyTypeHandle
SetHandleSize( h, size )
end fn
Lastly, your size calculation was:
> end fn = fn GetHandleSize( h ) \ sizeof ( testRec )
Here '\' forces a floating point division. Use '/' instead.
Robert P.
--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...