| Deutsch English Français Italiano |
|
<vrmkg3$308h$2@news.muc.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Alan Mackenzie <acm@muc.de>
Newsgroups: comp.lang.c++
Subject: Re: ({
Date: Sat, 22 Mar 2025 15:20:35 -0000 (UTC)
Organization: muc.de e.V.
Message-ID: <vrmkg3$308h$2@news.muc.de>
References: <vrhmme$8v0$1@news.muc.de> <vrjgh8$1bqpn$1@dont-email.me> <vrm4rl$2ue$1@news.muc.de> <lwzDP.1208305$_N6e.415187@fx17.iad>
Injection-Date: Sat, 22 Mar 2025 15:20:35 -0000 (UTC)
Injection-Info: news.muc.de; posting-host="news.muc.de:2001:608:1000::2";
logging-data="98577"; mail-complaints-to="news-admin@muc.de"
User-Agent: tin/2.6.4-20241224 ("Helmsdale") (FreeBSD/14.2-RELEASE-p1 (amd64))
Scott Lurndal <scott@slp53.sl.home> wrote:
> Alan Mackenzie <acm@muc.de> writes:
>>Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>> On 20.03.2025 20:27, Alan Mackenzie wrote:
>>> It appears the statement expressions are a gcc extension which does not
>>> even compile in standard C++, and is probably not needed for anything in
>>> C++ as there are better options like templated and inlined functions.
>>> In C there might be some usage case for it.
>>I'm not sure what you meant by templated functions here, but an inline
>>function has the disadvantage of fragmenting the code. Rather than have
>>a few lines of code where they're used, you need to look somewhere else
>>to see what they do.
> An inline function name should be chosen such that it is sufficient to
> define exactly what the effect of the function call will be, while
> still hiding the implementation and improving readability.
Yes, that's fine in theory. In practice, meaning while debugging, a
whole lot of midget functions, each called something like
convert_next_char_to_upper_case_is_it_Q_p is a nightmare. That name is
more difficult to understand than the three lines of code (see another
of my posts in this thread) it replaces.
While debugging, _nothing_ can be trusted to do what it says, and a
hidden implementation makes things worse - rather than having to scroll
a window to the inline function, it's probably in a different file.
Even a single midget function which isn't a coherent thing makes
debugging more irksome than simply having the three lines of code
physically in the larger function where they are actually used.
--
Alan Mackenzie (Nuremberg, Germany).