Re: GdkColor weird type? Why not pointer like GtkWidget*....



From: Christian Seberino <seberino spawar navy mil>
>
> Thanks so much for this reply! I was really confused
> about this!  Can I ask you a follow up question?
>
> Just to make GdkColor be like everything else (a pointer)
> is it OK to try declaring all colors to be pointer (GdkColor*) types???
>
> Then instead of:
>       Colors::myStaticColor.red = 343;
>
> I could hopefully do:
>       (*Colors::myStaticColor).red = 343;
>
> or even better, Colors::myStaticColor->red = 343; 
>
> Hopefully I can then initialize things to make them look more like a class:
>
>        GdkColor* Colors::myStaticColor = (GdkColor*) 0;

This'll get you a nice seg fault.

You're declaring a pointer, but not allocating any memory.

> Is there any reason this fantasy should not work??? I tried last nite
> and got seg faults so I don't know if this is not doable or I just
> made a dumb mistake.  As you said, GdkColor is a "extern C struc".  I'm not
> a "extern C struc" expert. :(

Go look at any basic C language reference (not C++).

Ron Steinke



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]