From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70606 invoked by alias); 23 Nov 2016 02:27:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 70573 invoked by uid 89); 23 Nov 2016 02:27:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-PHP-Originating-Script:rcube.php X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 02:27:11 +0000 Received: by simark.ca (Postfix, from userid 33) id 687FA1E74F; Tue, 22 Nov 2016 21:27:09 -0500 (EST) To: Pedro Alves Subject: Re: [PATCH v2] gdb: Use C++11 std::chrono X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 23 Nov 2016 02:27:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <4dc8d860-16f0-65cc-796c-da240d8ffd9f@redhat.com> References: <1479402927-4639-1-git-send-email-palves@redhat.com> <284edd6f2f85cd2c7cb9306a07a15b2a@polymtl.ca> <4dc8d860-16f0-65cc-796c-da240d8ffd9f@redhat.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.2 X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00660.txt.bz2 On 2016-11-22 21:17, Pedro Alves wrote: > I kept them (from v1) for type-safety: it makes it impossible to swap > the arguments to this new now() method by mistake, or compare old > system time with new user time by mistake. E.g.: > > /usr/include/c++/5.3.1/chrono:650:7: note: candidate: template _Clock, class _Dur1, class _Dur2> constexpr typename > std::common_type<_Duration1, _Duration2>::type > std::chrono::operator-(const std::chrono::time_point<_Clock, > _Duration1>&, const std::chrono::time_point<_Clock, _Duration2>&) > operator-(const time_point<_Clock, _Dur1>& __lhs, > ^ > /usr/include/c++/5.3.1/chrono:650:7: note: template argument > deduction/substitution failed: > src/gdb/mi/mi-main.c:2493:48: note: deduced conflicting types for > parameter ‘_Clock’ (‘system_cpu_time_clock’ and ‘user_cpu_time_clock’) > duration utime = end->stime - start->utime; > ^ > > Would you still prefer I remove those? That sounds useful, I'm convinced. >> Unrelated: for future work, it looks like an std::priority_queue would >> be a nice match for timer_list. > > Maybe, but we'd need to inherit from it in order to be able to > delete timers that are not at the top of the heap. A set or > multiset would be other options. You're right: https://stackoverflow.com/questions/19467485/c-priority-queue-removing-element-not-at-top Perhaps that's a bit too much for the amount of timers we usually have though...