On Wed, May 15, 2002 at 10:38:40PM +0200, W. Brian Blevins wrote:
> John,
>
> While I'm glad to see the SDK 4.0 update 1 flags these issues, I'm
> not sure that it should completely break the compile. Have you ever
> seen javac (the Sun java compiler) complain about the use of
> deprecated APIs?
Hah! Don't even talk to me about how to deprecate APIs! :-)
(But actually you're not just talking to me, even though you've
introduced your posting as if you are. Even if you happen to be
replying to a public comment of mine, you're writing to *thousands*
of people, not just me. There's no need to preface your message with
a salutation just to me. Please don't. (That's a public service
announcement, not just directed at Brian.))
> Of course, breaking the compile may be the only
> option in gcc, my ignorance of the compiler internals...
This is not a GCC question. It is a Palm OS SDK question. A similar
error message is produced by CodeWarrior in these circumstances.
And yes, this was the only sensible way of using the SDK's header files
to flag access to these opaque structures' fields.
> I have some code for getting an item pointer that can only work
> after PalmOS 3.5 (TblGetItemPointer()). However, my product supports
> PalmOS 3.0 and later.
You always have the option of avoiding needing to read the item's
pointer datum. For example, depending on what is actually stored in
there that you need to read, you could encode the relevant data as an
Int16 and attach it to the table item's integer datum, which you can
access via TblSetItemInt / TblGetItemInt with no OS version issues.
> So, I wrote a glue function to test the ROM
> level (sysFtrNumROMVersion) and do the right thing. Of course, the
> SDK 4.0u1 flags the structure reference in the pre 3.5 branch as
> unacceptable.
>
> As best I can tell, "TblGlue.h" does not provide glue for
> TblGetItemPointer() and if I
>
> // #define DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS
>
> then any other "real" mistakes which are accessing struct internals
> will not get caught.
Put your homemade glue function in a translation unit of its own, and
define ALLOW_ACCESS_TO_INTERNALS_OF_TABLES only in that translation unit.
Specifically, put your glue function in a .c file of its own, and
include the SDK headers like this:
#define ALLOW_ACCESS_TO_INTERNALS_OF_TABLES
#include <Table.h>
void *MyTblGetItemPtr (const TableType *t, Int16 r, Int16 c)
{ ... }
Then if you make any "real mistakes" in other translation units, they
will still be caught at compile-time.
John
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/