From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 15 Aug 2019 01:21:10 +0300 From: Konstantin Osipov Subject: Re: [tarantool-patches] [PATCH v2 2/8] decimal: fix encoding numbers with positive exponent. Message-ID: <20190814222110.GE28533@atlas> References: <53d58fa5cad01273d3e60fe034c8e74f023d3c0e.1565263272.git.sergepetrenko@tarantool.org> <20190812211838.GD32337@atlas> <72BD3FFE-9D36-41DA-B11D-2E30E9A5D294@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <72BD3FFE-9D36-41DA-B11D-2E30E9A5D294@tarantool.org> To: Serge Petrenko Cc: Vladimir Davydov , tarantool-patches@freelists.org List-ID: * Serge Petrenko [19/08/13 12:03]: > Similar code is already used in > mp_encode_extl/mp_decode_extl() > (yes, it was also introduced by me, but it passed the review): > > (the type of ’type’ is int8_t) > data = mp_store_u8(data, type); > … > *type = mp_load_u8(data); The problem with this approach is that you lost sign in your storage representation. Imagine this data format is read by a code which is different from the one you wrote, and relies on msgpack format specifiers alone. It will honestly believe that the value is always positive. Basically, you should follow MsgPack guidelines for choosing format specifiers. -- Konstantin Osipov, Moscow, Russia