Simon 'corecode' Schubert <corecode@xxxxxxxxxxxx> writes: > Ramsay Jones wrote: >>>> - printf("%s%06o %s %d\t", >>>> + printf("%s%06lo %s %d\t", >>>> tag, >>>> ntohl(ce->ce_mode), >>> I think we should do this instead: >>> >>> printf("%s%06o %s %d\t", tag, (unsigned) ntohl(ce->ce_mode), ... >> >> Oops, yes you are right. >> (cygwin typedef's uint32_t as unsigned long.) >> >> However, I would hate to add all those casts! Casts are not always >> evil, but should be avoided if possible. Having said that, I don't >> see another solution ... > > shouldn't it be something like this? > > printf("%s%06"PRIo32" %s %d\t", tag, ntohl(ce->ce_mode), ...) > > that's the correct and allegedly portable way I guess. Yes, except that that is only portable across platforms with inttypes.h, and we would need a compatibility definition in git-compat-util.h next to PRIuMAX definition we already have. But I wonder if this is really worth it. The thing is, printf("%s%06o %s %d\t", tag, (unsigned) ntohl(ce->ce_mode), ... is perfectly readable for even old timers about git, as long as they know traditional C and what ntohl() is. And ce->ce_mode even fits in 16-bit, so while we are _not_ supporting platforms whose unsigned int is 16-bit, the above cast is not losing any useful precision either. - 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