From: Wu Y. <ad...@ne...> - 2002-02-28 06:26:46
|
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 fpu > 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 did on http://www.geocities.com/yongweiwu/time.htm And will it be declared (or defined) in sys/time.h? I think it a good place. Best regards, Wu Yongwei |
From: Wu Y. <ad...@ne...> - 2002-02-28 09:34:42
|
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[2].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[2].h. So I gave it up for the moment. Unless you have a better idea, of course. Best regards, Wu Yongwei |
From: <dan...@ya...> - 2002-02-28 09:05:59
|
--- Wu Yongwei <ad...@ne...> 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 > I > did on > > http://www.geocities.com/yongweiwu/time.htm > 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 function-by-function basis) BTW, timeval is defined in winsock[2].h, so you may want to protect it in your header. Danny http://movies.yahoo.com.au - Yahoo! Movies - Vote for your nominees in our online Oscars pool. |