Thread (1 message) 1 message, 1 author, 2020-06-14

Re: [PATCH v2 0/3] pkt-line: war on magical `4` literal

From: Junio C Hamano <hidden>
Date: 2020-06-14 21:32:59

Denton Liu [off-list ref] writes:
+static inline void control_packet_write(int fd, const char *s, const char *type)
+{
+	packet_trace_str(s, 1);
+	if (write_str_in_full(fd, s) < 0)
+		die_errno(_("unable to write %s packet"), type);
This construct, whether "type" is a localized string _("...")  or
English literal "...", would not translate well, would it?  The
former causes sentence lego and the latter injects untranslated
adjective that modifies the word "packet" in the final sentence.

As write_str_in_full() MUST count how long the string is at runtime,
without any possibility to offload the work to compiler, when these
strings that are sent with the "magical 4" are all compile-time
constant literal strings, I am not sure if this is something we
should be happy with---we should aim better for a solution that does
not require the runtime to count if possible.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help