Re: send_to_charf, Take 2

From: George Greer (greerga@circlemud.org)
Date: 07/11/01


On Wed, 11 Jul 2001, Alex wrote:

>> > > >> Not that we could use GCC printf format checking anyway due to
>> > > >> handling $-style parameters ourselves.
>
>> Oh, I see, you want compile-time checking.  Well, unless we pull some
>> really imaginative macro stunts I don't see how that's possible.  But I
>> think runtime checking should be fine.
>
>As otherwise mentioned, if we rely on this, we cut out every other
>compiler out there (ie, windows, sun, hp, etc, etc, etc) because only gcc
>has that 'enhancement'.
>
>Spending a lot of time reworking something like this for one compiler is
>not worth the effort.

If we rework it to work under GCC _we_ use it and can therefore make sure
the stock code is ok.  Otherwise you rely on run-time checking.  It would
depend on the amount of reworking really.  For the simple case of the
format checking itself, we just pull the trick where:

#ifndef __GNUC__
#define __attribute__(x) /* Nothing */
#endif

void   send_to_charf(struct char_data *ch, const char *messg, ...)
       __attribute__ ((format (printf, 2, 3)));

Other compilers should have that feature anyway, maybe they will later.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST