How to use C89 with certain C99 features
richardcavell@mail.com
richardcavell@mail.com
Tue Apr 5 15:45:00 GMT 2011
> We have such situations where the platforms w/o vaargs are
> "small" anyway and the overhead for __FILE__ in the binaries is
> bad anyway, so simple solution is to simply on those platforms do
> /not/ use file and line; two implementations of myfunc: one with
Well, because it's a Wikipedia bot, it's entirely foreseeable that the
program will encounter an error through no fault of its own (Internet
connection goes down, Wikipedia servers lag, unusual activity on
Wikipedia results in rare unhandled error, etc). Error conditions have
to be reported, and __FILE__ is a part of that.
> when having e.g.:
> function func(long seconds)
> {
> struct timeval t = { seconds, 0 };
> }
> you should to use
> function func(long seconds)
> {
> struct timeval t = { 0 };
> t.tv_sec = seconds;
> }
Okay, but what about if I have const members? Here's my handle (these
variables should all be globals but I'm told not to use them):
struct parameters
{
CURL *const curlhandle;
FILE *const fplog;
const struct buffers buffers;
const struct preferences prefs;
char *szloginname;
char *szedittoken;
};
typedef struct parameters *BOTHANDLE;
More information about the Gcc-help
mailing list