Skip to content

Commit 6a8dc38

Browse files
authored
Store zmq_timers_timeout() result in long, not int (#681)
[why] When compiling with -Wconversion, gcc 13.3 issues a warning: zmq.hpp: In member function ‘zmq::timers::timeout_result_t zmq::timers::timeout() const’: zmq.hpp:2857:41: warning: conversion from ‘long int’ to ‘int’ may change value [-Wconversion] 2857 | int timeout = zmq_timers_timeout(_timers); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~ zmq_timers_timeout() returns long, but its return value is stored in an int variable, which may or may not be a mismatch depending on compiler and architecture. [how] Simply adjust the type of the variable from int to long. We could also change the literal in the following comparison from -1 to -1L, but that seems pedantic and does not match the style of the surrounding code. Signed-off-by: Lars Froehlich <[email protected]>
1 parent 9b6b5dd commit 6a8dc38

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

zmq.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2928,7 +2928,7 @@ class timers
29282928

29292929
timeout_result_t timeout() const
29302930
{
2931-
int timeout = zmq_timers_timeout(_timers);
2931+
long timeout = zmq_timers_timeout(_timers);
29322932
if (timeout == -1)
29332933
return timeout_result_t{};
29342934
return std::chrono::milliseconds{timeout};

0 commit comments

Comments
 (0)