Re: [AD] 2 errors encountered in current CVS

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


> Peter Wang wrote:
> >    /* for compilers without inline ability, and causes warnings for
> >     * unused static functions: */
> >    #define clear(bmp)   ((clear_bitmap)(bmp))
> 
> But this will still break code with C++ methods named `clear()'. I
> really don't think we can use a macro under any circumstances. It's not
> nice to get a warning all the time, but IMHO it's even worse to break
> people's code every now and then. But I like the idea to make it static,
> it seems to solve all problems!
> 
> Also, note that under gcc you can do
> 
>    static __attribute__((unused)) void clear(BITMAP *bmp)
>    {
>       clear_bitmap(bmp);
>    }
> 
> to prevent the warning. Under msvc you can use
> 
>    #pragma warning( disable : 4505 )
> 
> This pragma could be optional since people might want the warning for
> other static functions. gcc and msvc ought to be the far most important
> platforms, and there may be similar #pragmas for other platforms as
> well.

Nothing to add to this but one little thing =)

In MSVC, compiling this program using the maximun warning level

static void clear(void) {
  printf("clearing");
}

int main(int argc, char* argv[])
{
  //clear();
 printf("Hello World!\n");
 return 0;
}

I didn't get the typical gcc warning (that only appears when using -Wall)
warning: `void clear()' defined but not used

So, in other words, I don't think we even need to use that pragma at all =)



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