[Toybox] [PATCH] nohup: use the same mode constant for open() and xcreate().
enh
enh at google.com
Tue Jan 31 20:57:12 PST 2023
aye, but only if you're stuck with a compiler from the 1990s... even gcc
has warned about that for years :-P
On Tue, Jan 31, 2023, 20:33 Rob Landley <rob at landley.net> wrote:
> On 1/31/23 10:33, enh via Toybox wrote:
> > The open() call was the only remaining use of the named permission
> > constants, and the equivalent permissions are given in octal just
> > a couple of lines later. This seems like a solid entry for the next
> > toybox release's pedantry award.
>
> I applied this, but FYI the constant == function() stuff is so a typoed
> assignment instead of comparison barfs with not-an-lvalue. It's a style
> thing
> where an assignment not only _can't_ silently drop in for a comparison,
> and is
> also more easily visually distinguished. (If constant is on the left it
> can only
> be a comparison.)
>
> Serves a purpose. In this case you can't assign to a function return
> value, but
> *function() happens too, and the warning unless it has parentheses isn't a
> strong defense either because a&b || c also needs parentheses so they tend
> to
> happen...
>
> Otherwise they're theoretically equivalent, so changing it to be the other
> way
> because it "looks wrong" otherwise... seems weird to me? It looks like it
> couldn't be an assignment. That's the point...
>
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230131/08775bd7/attachment.htm>
More information about the Toybox
mailing list