Suppose we have a type T.

The declaration "const T* p" means that p is of type pointer to type T such
that the thing pointed to cannot be modified by dereferencing p.

Therefore, if a function is declared as

void foo(const T* p);

then, loosely speaking, all this means is that foo guarantees that it does
not modify *p.

What this means is that to call foo, you do NOT need to pass an argument of
type const T*; you can pass an argument of type T* without an explicit cast
and without warning.

So in your case, all you need is:

RGBColorType rgb = { 0, 255, 0, 0 };
WinSetForeColorRGB(&rgb, NULL);

Also, why are you setting the rgb.index field to NULL?  Although the NULL
macro is defined to be 0, it is poor style to assign it to variables that
aren't pointers.


"Craig Belson" <[EMAIL PROTECTED]> wrote in message
news:88575@palm-dev-forum...
>
> Alright, what I'd ideally like to do is assign a color
> at random to that, but it takes a const RGBColorType
> *, which I can't seem to be able to figure out how to
> code... I keep getting messages telling me that I
> can't set null as the first field of the struct, and
> the other message I get is that there's an illegal
> implicit conversion - for want of a better idea, what
> I have in my code right now is an RGBColorType set to
> (NULL, 255,0,0) and a const RGBColorType* that I'm
> trying to assign the RGBColorType to.  I didn't think
> it would work, but it was worth a try... how am I
> supposed to do this?  Has anyone had better luck with
> one of the other methods of assigning color to a pen?



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

Reply via email to