From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.devel Subject: Emacs' C: static inline considered useless nowadays? Date: Sun, 16 Oct 2022 15:08:51 -0700 Message-ID: <874jw37764.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7368"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 17 00:12:36 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okBs2-0001kI-Tx for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 00:12:34 +0200 Original-Received: from localhost ([::1]:41898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okBs1-0005Oa-O2 for ged-emacs-devel@m.gmane-mx.org; Sun, 16 Oct 2022 18:12:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okBol-0001fQ-Aw for emacs-devel@gnu.org; Sun, 16 Oct 2022 18:09:11 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:52093) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okBoY-0007Pj-DZ for emacs-devel@gnu.org; Sun, 16 Oct 2022 18:09:10 -0400 Original-Received: (Authenticated sender: matt@rfc20.org) by mail.gandi.net (Postfix) with ESMTPSA id B877F240003 for ; Sun, 16 Oct 2022 22:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rfc20.org; s=gm1; t=1665958133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=ODX4XJxQcwSg31pP83B8EDIU8J7XT47LFhxEpvYwPhs=; b=YBdr+IbFEJwpLiNotxMQOWZrqPdb6JeGnF8D2S2lWD9cYISqxs97bY5ra7NIUiAe1qkS89 IkEV9E51NYpmzKTzPVhrMIB58U6PwMhVLJoU+AKtszy2CzjveRnv3tEhJEd4NpnZC3h+8z pUcXBRWQe/4zRw68ASMcDig+au/BJZutb7Ek59xqwdPtvPCqXvVn1WjlGxegBpVMG4fwRn Z6b2GDZS+ur7jftW6Ab0i2GVE2aggkbTmxJBYdxspg/cv3ZVtMd3hkwujYDd+BMgLnO3D6 cAtMVJvfHcKL0ItVamJtZbtKnXwftusw2Y45BBJYNQl/beD8gD95mQMIZl1Fbg== Original-Received: from matt by naz with local (Exim 4.96) (envelope-from ) id 1okBoR-000HR8-0E for emacs-devel@gnu.org; Sun, 16 Oct 2022 15:08:51 -0700 Received-SPF: pass client-ip=217.70.183.193; envelope-from=matt@rfc20.org; helo=relay1-d.mail.gandi.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297886 Archived-At: For Emacs, I would think: a) In header files, use Emacs' INLINE and NO_INLINE macros. b) In .c files, use static, EXTERN_INLINE, but never 'inline' since it does nothing. I'm seeking confirmation (or refutation) of (a) and (b). I'm not asking generally, but for Emacs' C code. Specifically, ignoring the uselesness of the function itself, assuming the code is in a .c file, is the use of the "inline" keyword redundant with static, below? static inline int add_two_int (int a, int b) { return a + b } I've spent the last few decades coding with an undersanding that "inline" is about linkage and allows one to place code in header files so that it *may* be inlined, but that compilers long ago stopped using it as a meaningful inlining hint. But this is mostly colored by how gcc and clang behave with C++, and not much else. -- matt (sent from an Emacs running the feature/noverlay branch)