[Tarantool-patches] [PATCH v2 03/10] raft: fix say_x arguments

Cyrill Gorcunov gorcunov at gmail.com
Thu Feb 25 10:50:03 MSK 2021


On Wed, Feb 24, 2021 at 11:39:47PM +0100, Vladislav Shpilevoy wrote:
> Thanks for the patch!
> 
> On 24.02.2021 16:36, Cyrill Gorcunov wrote:
> > Use explicit "%lld" for int64_t type.
> 
> In the changes you use %llu in both cases.

Good catch! Thanks.

> > @@ -322,7 +322,8 @@ raft_process_msg(struct raft *raft, const struct raft_msg *req, uint32_t source)
> >  	/* Outdated request. */
> >  	if (req->term < raft->volatile_term) {
> >  		say_info("RAFT: the message is ignored due to outdated term - "
> > -			 "current term is %u", raft->volatile_term);
> > +			 "current term is %llu",
> > +			 (long long)raft->volatile_term);
> 
> It is unsigned. So the cast must be 'unsigned long long'.
> The same below.

Atually this is done on a purpose. Signed/unsigned objects are kept
in same amount of memory storage, which is guaranteed by the standart.
We can use (long long) here to specify the size of object while
the sign gonna be interpreted by formatter itself, and this is
what our static formatter does test -- storage size. So no, I
think we can continue use (long long) specificator here.


More information about the Tarantool-patches mailing list