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 <r...@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
>
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to