Whoa, this is probably a result of inertion.

After programming for for X11 and MS Windows 
I couldn't imagine that a memory handle can be
something different from a 32-bit integer! 

Well, I wouldn't be surprised then if 
GCC doesn't complain either...

M.



-----Original Message-----
From: Ben Combee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 12 December 2001 15:11
To: Palm Developer Forum
Subject: Re: Saving Form Results to a DB (DmWrite Bus Error)


"Michael Glickman" <[EMAIL PROTECTED]> wrote in message
news:70981@palm-dev-forum...
>
> GCC would give a warning in this case (when used with -Wall), will CW
?

The problem line was:

DmWrite( MemHandleLock( h ), 0, h2, size );

The third parameter to DmWrite is a "const void *".  Since a MemHandle
is defined as a "struct _opaque *" by the PalmTypes.h header, it
converts silently into a const pointer to void, since both C and C++
allow any pointer to become a pointer to void (C++ disallows the other
way).

I don't think there is a way to get CodeWarrior to warn about this,
since it is valid C.  In a sense, it would be a lot better if MemHandle
was defined as a 4-byte struct, since that can't silently convert to
anything -- however, a struct like that wouldn't be able to be stored in
a register as a temporary by the compiler due to the more complicated
type.



-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to