From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id BE3594696C3 for ; Sat, 11 Apr 2020 16:35:53 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) From: Serge Petrenko In-Reply-To: <2b3e67d6-ce8b-2c52-b9c9-6ea5f5f666ae@tarantool.org> Date: Sat, 11 Apr 2020 16:35:52 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <68B5890F-67EF-489D-9255-892D594BD5F7@tarantool.org> References: <9042734e4ddc49d2e8903b346b84d699d1e2c46b.1585954493.git.sergepetrenko@tarantool.org> <61D44098-8826-479E-A7F9-E1122410A057@tarantool.org> <2b3e67d6-ce8b-2c52-b9c9-6ea5f5f666ae@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 2/4] uuid: expose additional from_string constructors List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tml > 10 =D0=B0=D0=BF=D1=80. 2020 =D0=B3., =D0=B2 19:56, Vladislav Shpilevoy = =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0= =B0): >=20 > Hi! Thanks for the fixes! Thanks for the reivew! >=20 >>> 6 =D0=B0=D0=BF=D1=80. 2020 =D0=B3., =D0=B2 00:22, Vladislav = Shpilevoy =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0= =D0=BB(=D0=B0): >>>=20 >>> Thanks for the patch! >>>=20 >>>> diff --git a/src/lib/uuid/tt_uuid.c b/src/lib/uuid/tt_uuid.c >>>> index 1bd2e2cfe..94a0b15bb 100644 >>>> --- a/src/lib/uuid/tt_uuid.c >>>> +++ b/src/lib/uuid/tt_uuid.c >>>> @@ -65,6 +65,15 @@ tt_uuid_create(struct tt_uuid *uu) >>>> } >>>> #endif >>>>=20 >>>> +extern inline int >>>=20 >>> 'inline' modifier won't change anything. The function body is >>> not visible anyway. >>=20 >> Not sure about that. >> What about other functions? >>=20 >> ``` >> extern inline int = =20 >> tt_uuid_from_string(const char *in, struct tt_uuid *uu); >> ``` >>=20 >> I=E2=80=99m still not sure what =E2=80=98extern inline=E2=80=99 does, = but I googled a stackoverflow >> question discussing it: >> https://stackoverflow.com/questions/216510/what-does-extern-inline-do >=20 > =46rom what I understood by the link above and here: = http://m68hc11.serveftp.org/inline-1.php > it looks like 'extern inline' does not make any sense for function > declaration. It should be used only for function definition in a > header file. Here=E2=80=99s what I=E2=80=99ve found: https://www.greenend.org.uk/rjk/tech/inline.html ``` A C99 model. Use inline in a common header, and provide definitions in a = .c file somewhere, via extern declarations. For instance, in the header = file: inline int max(int a, int b) { return a > b ? a : b; } ...and in exactly one source file: #include "header.h" extern int max(int a, int b); ``` So, AFAIU, if the compiler chooses to not inline the function, `extern = inline` will make it generate the object code for the function only in = `tt_uuid.c.o`. As I understood, the same effect can be reached by omitting `extern = inline`, and leaving only. ``` int tt_uuid_validate(... ```=20 But let=E2=80=99s stick with `extern inline` for consistency with other = declarations in tt_uuid.c -- Serge Petrenko sergepetrenko@tarantool.org