From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3] CodingGuidelines: use octal escapes, not hex
Date: Wed, 14 Jun 2023 14:54:50 -0700 [thread overview]
Message-ID: <xmqqo7lhwvyt.fsf@gitster.g> (raw)
In-Reply-To: <20230614213145.475607-1-jonathantanmy@google.com> (Jonathan Tan's message of "Wed, 14 Jun 2023 14:31:45 -0700")
Jonathan Tan <jonathantanmy@google.com> writes:
> Extend the shell-scripting section of CodingGuidelines to suggest octal
> escape sequences (e.g. "\302\242") over hexadecimal (e.g. "\xc2\xa2")
> since the latter can be a source of portability problems.
Sounds good. On a typical GNU system, /usr/bin/printf as well as
printf built into bash groks "\x<hex>" escapes in its format string,
but we cannot depend on it because POSIX does not require support
for "\x<hex>", and printf built into dash indeed does not. It is a
good idea to stress that this is specifically about the format
string (in other words, nothing magical happens when using octal or
hex escapes in say "printf '%s\n' '\302\242'").
> + - Use octal escape sequences (e.g. "\302\242"), not hexadecimal (e.g.
> + "\xc2\xa2") in printf format strings, since hexadecimal escape
> + sequences are not portable.
Will queue. Thanks.
prev parent reply other threads:[~2023-06-14 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 0:15 [PATCH v2] CodingGuidelines: use octal escapes, not hex Jonathan Tan
2023-06-14 0:28 ` Junio C Hamano
2023-06-14 21:31 ` [PATCH v3] " Jonathan Tan
2023-06-14 21:54 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo7lhwvyt.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).