X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:subject:mime-version:content-type :content-transfer-encoding:date:from:in-reply-to:references :message-id; q=dns; s=default; b=XtXCeKDctFE2jcfj0ifJDqNuJ7qhUHE hTL8TEIqvgAoT5zFp4O2eL4QI3N0nAPKJhja5UngnNN3yW0+8fLEFVQS+dthUk+P 5loqnwz+m3QihGwktWqGSqSHn7N096HBkta2Gz13iOJZTV/Y8qbPV5h5jJQR4R+1 FaZ2wsr6i9LA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:subject:mime-version:content-type :content-transfer-encoding:date:from:in-reply-to:references :message-id; s=default; bh=tqDwvFPdtwvUoaroyEwg579aMXY=; b=v8pgt 3VpLgFmOjV1WTlxPX7OzRDiXONpoxmdKqO323lkU/ojWyBuO7/xgLzcUBq+7RTof Uyk1f9AR/hA+YQHNPx0bE5+vglvCvJbjhMJQlVXwxNyL+joHthXF4SYXpRvTso8X +I6JY0WBa592Vu8Co6ynxj/4xTf5SHY84M7UZU= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=HX-PHP-Originating-Script:rcmail.php, HX-Languages-Length:1053, H*u:0.9.2, H*UA:0.9.2 X-HELO: smtp-out-no.shaw.ca To: cygwin AT cygwin DOT com Subject: Re: Bug in TIME function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Thu, 12 Sep 2019 11:16:27 -0700 From: Kaz Kylheku <920-082-4242 AT kylheku DOT com> In-Reply-To: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com> References: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com> Message-ID: X-Sender: 920-082-4242 AT kylheku DOT com User-Agent: Roundcube Webmail/0.9.2 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x8CIH5cZ009787 On 2019-09-12 11:05, tlake AT twcny DOT rr DOT com wrote: > The code below returns -1. It shouldn't. Says who? I don't see anything in the specification which says that a null pointer argument is allowed: https://pubs.opengroup.org/onlinepubs/9699919799/functions/times.html Passing a null pointer to an ISO C or POSIX library function results in undefined behavior, except where it is documented otherwise. GNU/Linux (specifically the Glibc implementation of libc) also doesn't document any such extension (being able to pass a null pointer to times). So even in light of the goal of Cygwin providing GNU/Linux compatibility beyond POSIX, there is no justification for supporting times(0). > #include > #include > > int main(int argc, char *argv[]) > > { > printf("return value %ld\n", (long)times((struct tms*)0)); The pointer cast is not required here; you have a prototype of the times function in scope; the equivalent times(0) will give you the undefined behavior you're asking for. > return 0; > } -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple