On 26 Feb 2003, David L Norris wrote:
> I suspect that was an oversight on my part when I replaced the #ifdef
> WIN32 with a more general version. Windows prefixes Standard C
> functions with _ unless STDC (or something like that) is defined. It
> should be safe to remove the _ prefix completely.
I think it's correct to test for a feature instead of an OS, but it might
require a bit more testing in the configure script.
Bill Meier replied to me with a bit of research. It's not entirely clear
what the correct thing to do is (especially since you build the Windows
binary on Linux).
Bill found example code that does this:
#ifdef _WIN32
#define FTIME(dummy) _ftime(dummy)
#define TIMEB _timeb
#else
#define FTIME(dummy) ftime(dummy)
#define TIMEB timeb
#endif
So that might be one option, but not really the "autoconf" way of testing
for features.
He also pointed out:
http://www.cgal.org/Manual/doc_html/support_lib/Miscellany_ref/Class_Real_timer.html
which says
"The timer class is based in the C function gettimeofday() on POSIX
systems, the C function _ftime() on MS Visual C++, the C function ftime()
on Borland C++, and time() on Metrowerks Codewarrior."
So I'm not sure change to just ftime() wouldn't break things on Windows.
Perhaps the check for gettimeofday needs to be expanded in configure.in.
[I would think that there would be a standard macro for checking this as
it seems like a common need in portable programs.]
That code is getting close to two years old, so it has not been a huge
issue for people.
--
Bill Moseley moseley@hank.org
Received on Wed Feb 26 16:23:42 2003