-
Function overloading
Hi everyone,
I found a library that defines a preprocessor function style like this:
Code:
#define_EXFUN(name, proto) name proto
and then declare the functions like this:
Code:
clock_t _EXFUN(clock, (void));
double _EXFUN(difftime, (time_t _time2, time_t _time1));
time_t _EXFUN(mktime, (struct tm *_timeptr));
time_t _EXFUN(time, (time_t *_timer));
What is the purpose of the preprocessor style function? I mean it could just be ommited and declare the function like this right?
Code:
clock_t clock(void);
double difftime(time_t _time2, time_t _time1);
time_t mktime(struct tm *_timeptr);
time_t time(time_t *_timer);
-
Were you looking at a standard library implementation? Is there an alternative definition of the _EXFUN macro depending on say, a #if preprocessor directive?
-
1 Attachment(s)
Yes your're right..
Attachment 16299
-
You'll need to fix that link.
-
Well, then you have your answer: it is to adjust the function declaration based on a preprocessor definition.
-
Yes, thanks for the quick tip!!