This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] gdb: Use C++11 std::chrono


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<class
_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<double> 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...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]