RE: Data Types
Brought to you by:
jmarshall
From: ET T. <et...@mi...> - 2001-09-06 10:46:20
|
I see the problem now.... not in Palm OS SDK, but in my program. I have a program (in C) on Win32 and now porting it to the Palm platform. Throughout the entire program, I have variables of types int, char, long, char *, int *, uses malloc.. all the common stuffs on Ansi C. I compiled a small portion and the compiler doesn't complain about the variables types. So does it mean that I can use int, char, etc on Palm? If yes, what is the size of an int on Palm platform? 16bit or 32bit? Is it safe if I replace all malloc with MemPtrNew? as MemHandleNew returns a type struct. -----Original Message----- From: Jean Delvare [mailto:de...@en...] Sent: Thursday, 6 September 2001 4:34 PM To: ET Tan Cc: prc...@li... Subject: Re: Data Types > Can I safely assume > > Ansi C Palm > int Int > long Long > void * VoidPtr > > ? Better don't. There is no such thing as Int or Long. You tell explicitely how many bits you want, choosing between 8,16 and 32, and if you want them signed or not. The 6 types are: Int8, Int16, Int32, UInt8, UInt16, UInt32. > Also, what is the difference between MemPtr and MemHandle, sorry, I > really couldn't distinguish these 2 even after reading the Palm OS Ref. Well, memory management is special on PalmOS. There are two kinds of memory chunks, namely movable and not movable. When you ask for a Handle, you have a movable chunck. It means the system may move it somewhere else if needed. Then, you lock it and can use it (it's not movable anymore). When you don't need it for a while, you unlock it, making it movable again. http://www.palmos.com/dev/tech/docs/palmos/Memory.html#938406 Asking for a MemPtr without a MemHandle makes it definitely non movable. It is generaly a bad idea unless you would lock the handle imediately, use it only "once" and unlock it just before releasing it. -- /~~ Jean "Khali" Delvare -----\_ mail: de...@en... --------\ http://www.ensicaen.ismra.fr/~delvare/ ---=ISMRA/- ____________________________________________________ |