delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-Injected-Via-Gmane: | http://gmane.org/ |
To: | cygwin AT cygwin DOT com |
From: | "Alex Vinokur" <alexvn AT connect DOT to> |
Subject: | clock_t & return -1 |
Date: | Tue, 14 Oct 2003 19:31:45 +0200 |
Lines: | 55 |
Message-ID: | <bmhbv6$fu1$1@sea.gmane.org> |
X-Complaints-To: | usenet AT sea DOT gmane DOT org |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1106 |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1106 |
# ------ 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:alexvn AT connect DOT to 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |