Junio C Hamano <gitster@xxxxxxxxx> writes: > Kjetil Barvik <barvik@xxxxxxxxxxxx> writes: > >> Make the macros take a pointer to a 'struct stat'. This is so that it >> should be easier to understand what is going on, and that the macros >> can later be implemented as a inline function if we want to. >> >> Impact: cosmetic change > > Hmm,... > > I have to wonder if this cosmetic change is an improvement, though. > > I do not have a strong feeling either way, but I think it makes it > clear that these two macros are not lvalues if you do not pass a > pointer but instead pass a structure. An inline function can still > take a structure passed by value as an argument anyway, no? It seems to woork from a small gcc test, but since C has call-by- value, and http://en.wikipedia.org/wiki/Call_by_value#Call_by_value says: [...] in C or Pascal, calling a function with a large structure as an argument will cause the entire structure to be copied, potentially causing serious performance degradation, and mutations to the structure are invisible to the caller. [...] So in my eyes it make more sense to be consistent and take the address of all struct like objects (&st in this case) for all arguments to "function-like" things. But, since these 2 are macros, which use textual substitution, I guess things will work correctly either way, and the compiled result will be the same. But, I still like the more "function friendly" macros. -- kjetil -- 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