Re: [PATCH 1/2] tests: eliminate unnecessary setup test assertions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King wrote:

> So there are definitely particular people who prefer different styles
> (and I recalled that Junio and I differed on this style point, which is
> confirmed here). Interestingly, you are the only person to fall right in
> the middle.  I guess that means you are good at emulating surrounding
> code. :)

Probably my older code leaves out the space more often, and newer code
includes it.  There is an odd kind of logic that can be used to
justify including or not including the space, namely:

In C, a function definition starts with an expression that looks
something like a function call, as in "double sin(double x);".  So
when you want to know everything there is to know about the sine
function, you can do a "git grep -F -e 'sin('", and it will return to
you its definition and a list of callers.

The shell function definition syntax looks oddly like an old-style C
prototype "f()".  But do not be misled: to duplicate the above
property familiar from C, one needs to include a space before the
parentheses, so "git grep -F -e 'f '" will return its definition and a
list of callers.

Of course the same argument works backwards: if you want the
definition without the callers, then only the spaceless syntax will
allow you to grep for 'f()'.

Unlike brace placement, this seems to be a question of style with no
right answer. :)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]