Re: [AD] PALETTE and RGB* (part 2)

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


On 2002-07-26, Eric <ebotcazou@xxxxxxxxxx> wrote:
> > If you put these prototypes in the same file, a C compiler will not
> > complain, so they are all equivalent:
> >
> >     void foo(RGB *pal);
> >     void foo(RGB pal[PAL_SIZE]);
> >     void foo(PALETTE pal);
> 
> Sorry for being so picky, but did you check with a C++ compiler ?

Yes, I should have said so:

    tjaden@xxxxxxxxxx ~ $ cat t.c
    #define PAL_SIZE 256
    typedef struct RGB { unsigned char r, g, b, filler; } RGB;
    typedef RGB PALETTE[PAL_SIZE];
    void foo (RGB *pal);
    void foo (RGB pal[PAL_SIZE]);
    void foo (PALETTE pal);
    void foo (RGB *pal) { }
    int main (void) { return 0; }
    tjaden@xxxxxxxxxx ~ $ gcc -W -Wall -Wno-unused -ansi -pedantic t.c
    tjaden@xxxxxxxxxx ~ $ mv t.c t.cc
    tjaden@xxxxxxxxxx ~ $ gcc -W -Wall -Wno-unused -ansi -pedantic t.cc
    tjaden@xxxxxxxxxx ~ $ 

> - Eric (who experienced a disk crash yesterday on this computer, luckily not
> his, but lost a bunch of Allegro e-mails in the disaster though... :-(

I can send some if you want.

-- 
王浩禎



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