Danny Smith wrote:
> I would like to have a library called libmingwex.a which contains:
> 1) what is now in libisocext.a
> 2) a few more C99 math functions that will be declared in math.h (fp
> classification functions and macros) and new C99 header fenv.h (get/set
> environ, rounding mode, fp exception trapping)
> 3} The nan business which is related to (2)
> 4) dirent
> 5) a home for other POSIXisms. First on the list is gettimeofday.
For just the fifth point. Why not implement gettimeofday as an inline as I
And will it be declared (or defined) in sys/time.h? I think it a good place.
Danny Smith wrote:
> Also, with GCC inlines are not inlined unless
> optimization is turned off (although 3.1 has a new
"Off"? or "on"?
However, I do not expect GCC will inline my gettimeofday, in fact. Most
likely it will silently treat it just as static. Maybe in future it will,
but currently it seems only MSVC can do that.
> BTW, timeval is defined in winsock.h, so you may want to protect it in
> your header.
I thought of this, but did not find how, for MinGW and MSVC (and other
compilers) use different macro names (you are writing headers specifically
for MinGW and will not have this problem). One way is to include
<winsock2.h> in the _WIN32 branch, but it is not satisfactory at all. My
last thought is that if I used this timeval.h, I would be writing a
cross-platform application and it would be unlikely that I would use
winsock.h. So I gave it up for the moment. Unless you have a better idea,
--- Wu Yongwei <adah@...> wrote: > Danny Smith wrote:
> > 5) a home for other POSIXisms. First on the list is gettimeofday.
> For just the fifth point. Why not implement gettimeofday as an inline as
> did on
I've found it is a good idea to include library version as well as inline,
since configure scripts often provide there own prototypes and just test to
see if link succeeds. Also, with GCC inlines are not inlined unless
optimization is turned off (although 3.1 has a new
__attribute__((inline_always)) that will override that on a
BTW, timeval is defined in winsock.h, so you may want to protect it in
http://movies.yahoo.com.au - Yahoo! Movies
- Vote for your nominees in our online Oscars pool.