[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] Re: no rpl_mktime in mktime.c
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] Re: no rpl_mktime in mktime.c |
Date: |
Mon, 11 Jul 2005 13:35:41 +0200 |
User-agent: |
KMail/1.5 |
Paul Eggert wrote:
> I thought that C++ was supposed to be namespace clean
> these days. So isn't a standard C++ program supposed to be able to do
> this?
>
> #define mktime(x) (x)
> #include <ctime>
> int i = mktime (0);
No, this cannot work: <ctime> will typically contain a declaration like
extern "C" {
extern time_t ::mktime(struct tm *);
}
which through the macro definition becomes syntactically invalid:
extern "C" {
extern time_t ::(struct tm *);
}
> the usual pattern is something like this:
>
> In config.h:
>
> #define malloc rpl_malloc
>
> In malloc.c:
>
> #include <config.h>
> #undef malloc
> void *rpl_malloc (size_t n) { ... malloc (n) ... }
And when there are collision with system header files, sometimes the solution
is to move the
#define malloc rpl_malloc
definition to gnulib's header file.
But since this is a tricky matter, we first need to have a complete analysis:
"on a redhat
entreprise linux 3 with C++, gnulib wants to use its mktime, but in the
C++ headers mktime is undefined and then there is a build error."
- Which C++ header undefines mktime?
- Which header files are included by the program, in which order?
Bruno
- Re: no rpl_mktime in mktime.c, (continued)
- Re: no rpl_mktime in mktime.c, Patrice Dumas, 2005/07/08
- Re: no rpl_mktime in mktime.c, Paul Eggert, 2005/07/08
- Re: no rpl_mktime in mktime.c, Patrice Dumas, 2005/07/08
- Re: no rpl_mktime in mktime.c, Paul Eggert, 2005/07/08
- Re: no rpl_mktime in mktime.c, Patrice Dumas, 2005/07/09
- Re: no rpl_mktime in mktime.c, Paul Eggert, 2005/07/09
- Re: no rpl_mktime in mktime.c, James Youngman, 2005/07/09
- Re: no rpl_mktime in mktime.c, Patrice Dumas, 2005/07/11
- Re: no rpl_mktime in mktime.c, Paul Eggert, 2005/07/12
- Re: no rpl_mktime in mktime.c, James Gallagher, 2005/07/12
- Re: [bug-gnulib] Re: no rpl_mktime in mktime.c,
Bruno Haible <=
- Re: [bug-gnulib] Re: no rpl_mktime in mktime.c, Paul Eggert, 2005/07/11
- Re: [bug-gnulib] Re: no rpl_mktime in mktime.c, James Gallagher, 2005/07/11