From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-workers@zsh.org>
Subject: Re: [PATCH 2/2] Fix two C nits
Date: Tue, 19 Jun 2018 16:59:34 +0100 [thread overview]
Message-ID: <20180619155935eucas1p1eb3cceccb18423c4b00028059c8482e7~5mwC17Zmg2368823688eucas1p1K@eucas1p1.samsung.com> (raw)
In-Reply-To: <20180619143834.GA17383@zira.vinc17.org>
On Tue, 19 Jun 2018 16:38:34 +0200
Vincent Lefevre <vincent@vinc17.net> wrote:
> It's safe because whether the "return 0;" line is here or not, this
> will not change the behavior since this line is not reachable (even
> if the compiler doesn't know this).
>
> If the compiler doesn't know that _exit never returns, it will
> typically add an instruction corresponding to the "return 0;",
If I were a compiler and I saw
static int getpipe(char *cmd, int nullexec)
{
/* ... blah ... */
some_random_function();
}
I would immediately warn about missing return values --- indeed, gcc
does this with functions it hasn't been told about as I tested:
gcc_return.c:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
so we've taken a step back in terms of clean code (even if gcc itself
isn't the problem on a typical GNU-based system where it does know about
_exit).
Anyway, I've completely lost interest in this non-issue with what's
currently entirely valid code and don't propose to discuss it further.
pws
prev parent reply other threads:[~2018-06-19 15:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180616021439epcas4p327f4346b40d9e10d94ce055058fe0d71@epcas4p3.samsung.com>
2018-06-16 1:04 ` Eitan Adler
2018-06-18 9:22 ` Peter Stephenson
2018-06-19 5:31 ` Eitan Adler
2018-06-19 13:46 ` Vincent Lefevre
2018-06-19 14:13 ` Peter Stephenson
2018-06-19 14:38 ` Vincent Lefevre
2018-06-19 15:59 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='20180619155935eucas1p1eb3cceccb18423c4b00028059c8482e7~5mwC17Zmg2368823688eucas1p1K@eucas1p1.samsung.com' \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).