[AD] RE: [AD] PALETTE and RGB*

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] PALETTE and RGB*

> Can someone explain why some functions take "RGB *" arguments
> instead of
> "PALETTE" arguments (eg. load_bitmap compared with
> get_palette).  AFAICT
> they mean the same thing to a compiler, but PALETTE is easier
> to read (a
> full palette is expected, rather than a single RGB entry).

Well, it might or might not be related, but, say a function
expects a PALETTE* as argument, I recall getting very
annoying errors when passing a RGB** (or was it when
trying to pass a PALETTE* to something expecting a RGB**.
That's due to the typedef array. Should maybe be:

typedef struct {
  RGB colors[256];
} PALETTE;

That would help alot. Unfortunately, it would break source
compatibility. However, I think it would preserve binary
compatibility ;)

BTW, Scott Meyers recomments not to use typedef arrays :)

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/