Saurabh Agarwal wrote:
Hi,

Is there any Coding Guidelines for Palm OS Programming.
I want to prefix my variables with some standard string/char which can tell
the data type.

For example:
b is for Boolean
d is for Double
rc for RectangleType
p for Pointer (EventPtr).

There was n and w for various Int (Int8, UInt8, Int16, UInt16, Int32,
UInt32) but there is no consistency in naming these INTs. Can anybody
suggest me?

I refered to the POL examples given with Code Warrior.


First of all, as Jim said you should understand why each particular convention was invented in the first place.

Misunderstanding is why everybody makes their header include guards like __MY_INCLUDED_FILE__ which is *required* for system headers but *illegal* for application code. Don't just mimic blindly.

As for naming, I say use whatever you find helpful. Hopefully that's one of the prevailing standards.

I use a very simplified Hungarian:

  n for any integral type
  f for any floating type
  p for any pointer type

So you can change a type from double to float without changing your prefix.

If you change from double to int, that's a bigger change and requires more thought and testing, so putting a name change on top of it is justified, in my opinion.


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

Reply via email to