Mitch Fawcett wrote:

> Sorry for asking a basic programming question on this forum but it is
> relevant that I ask fellow Palm programmers.  I have two "C" books with
> conflicting information regarding passing a structure as an argument in a
> function.  One says I can pass an instance of a structure, the other says I
> can't and I should pass a pointer instead.  I'm having problems with some
> code I am writing that involves structures so I would like to get this
> clarified before I go much further.  

As others have said, it's a compiler issue and not an OS issue. 
However, you must excercise caution if you are using GCC. Passing a 
structure as an argument is one of several things that may cause the 
compiler to make a call to the standard run-time library behind your 
back (in this case it might call memcpy). Since the run-time library is 
not in the Palm device's memory, your app will crash.

If your reason for wanting to pass the struct by value rather than by 
reference is to avoid the possibility of modifying the structure via 
the pointer, consider using the const keyword.

--
Roger Chaplin
<[EMAIL PROTECTED]>

Reply via email to