Thanks for the advice.

So in future, would I be safe assuming that if C does
something a certain way, the same will hold true on
the Palm platform?

Cheers,
Joe

 --- Keith Rollin <[EMAIL PROTECTED]> wrote:
> Joe,
> 
> This is a generic C programming question.  It is not
> specific to Palm OS or its development tools, so you
> should probably post questions like this in a "how
> to program in C" forum.
> 
> In short, static structs (that is, those created as
> global variables or as statics local to a function)
> have their fields initialized to zero when the
> application starts.  Automatic structs (that is,
> those created as local variables) or structs
> allocated with malloc or MemPtrNew will have garbage
> in their fields.  It is up to you to initialize them
> to appropriate values after you've allocated the
> memory for them.
> 
> There is no supported method for determining if a
> pointer type contains a valid or invalid value.
> 
> -- Keith
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
>
[mailto:[EMAIL PROTECTED]
> Behalf Of joe
> bloggs
> Sent: Saturday, March 27, 2004 6:37 PM
> To: Palm Developer Forum
> Subject: Structure initialisation
> 
> 
> Hello Forum,
> 
> When a structure is created, does anyone know if
> it's
> elements are initialised? e.g. initegers set to 0
> and
> pointers/references set to NULL.
> 
> The reason I am asking is that my error handling
> code
> deallocates memory by checking if mem pointers are
> not
> NULL.  If structure elements are initialised, I can
> check to see if memory has been allocated as
> follows:
> 
> if (someStruct.memPointer)
> ...
> 
> If structure elements are not initialised, can
> anyone
> recommend a way to determine if a pointer is
> pointing
> to allocated memory (instead of just garbage).
> 
> --
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/ 

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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

Reply via email to