Re: [AD] Unused parameter

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


On Thursday 12 December 2002 8:33 pm, you wrote:
> > The attached patch for alcompat.h should fix this.
>
> --- alcompat.h.old	Thu Dec 12 18:29:01 2002
> +++ alcompat.h	Thu Dec 12 18:29:34 2002
> @@ -197,6 +197,7 @@
>  /* the old close button functions */
>  AL_INLINE(int, set_window_close_button, (int enable),
>  {
> +   (void)enable;
>     return 0;
>  })
>
>
> Isn't that a GCCism ?

Very early C code looked like this:

   (void)printf("yay\n");

because early compilers warned about unused return values. The idea of 
casting things to void, to indicate that you don't intend to use them, goes 
back a very long way, and MSVC supports it (hey, if it didn't, I'd have had a 
hell of a lot of complaints about DUMB by now). See the C FAQ, question 17.5, 
at:

   http://www.faqs.org/faqs/C-faq/faq/

Ben



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