# ------ man clock (fragments) ------ # NAME # `clock'--cumulative processor time # # # SYNOPSIS # include <time.h> # clock_t clock(void); # # RETURNS # The amount of processor time used so far by your program, in units # defined by the machine-dependent macro `CLOCKS_PER_SEC'. # If no measurement is available, the result is `-1'. # # -----------------------------------
------ C code : File t.c ------ #include <time.h> int main() { return (!(clock () == -1)); } ------------------------------- ------ Compilation ------ $ gcc -W -Wall t.c t.c: In function `main': t.c:4: warning: comparison between signed and unsigned ------------------------- So, clock() is unsigned and never returns -1 (?!) If one must write ---------------------------------- if (!(clock () == (clock_t)(-1))); ---------------------------------- I think it is worth noting that in the manual. -- ===================================== Alex Vinokur mailto:[EMAIL PROTECTED] http://mathforum.org/library/view/10978.html news://news.gmane.org/gmane.comp.lang.c++.perfometer ===================================== -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/