Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 2/2] Fix two C nits
- X-seq: zsh-workers 43069
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH 2/2] Fix two C nits
- Date: Tue, 19 Jun 2018 16:59:34 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180619155937euoutp018ac33f9ba9136e58b10670e64c609da5~5mwEldYkx0062100621euoutp01Z
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1529423977; bh=iceGxrMToL+Bw6nmMy/sH1rAP0Al3KXlHpHFeKY5Z5k=; h=Date:From:To:Subject:In-Reply-To:References:From; b=rc4HirOWBDHk0zW0flMy71LIRImxOvjEfUb0Eczp3xPDSPW3hnDSVtDyaPOVvn9vo dAbbw8SFiXLFSxdcn7gj4tgRYQTKKMqYAmUv/jT04gmOSSohozKJaju+OpacJwhNby T3SL+FaZP4S2ppLv+hZ4UxZmNKUgc4XTiXPTlPRM=
- In-reply-to: <20180619143834.GA17383@zira.vinc17.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: SCSC
- References: <CGME20180616021439epcas4p327f4346b40d9e10d94ce055058fe0d71@epcas4p3.samsung.com> <20180616010427.2916-2-lists@eitanadler.com> <20180618092243eucas1p133cc109ed17712cd4253a72da472fa54~5NsPXgtMr0676306763eucas1p1g@eucas1p1.samsung.com> <20180619134629.GA15318@zira.vinc17.org> <20180619141321eucas1p194af5292bb4f5030e0536c500ef9c6c5~5lTSLcvNm0521405214eucas1p1I@eucas1p1.samsung.com> <20180619143834.GA17383@zira.vinc17.org>
On Tue, 19 Jun 2018 16:38:34 +0200
Vincent Lefevre <vincent@xxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author