From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] [gdb] Add c_ctrl/c_unctrl
Date: Wed, 25 Mar 2026 11:40:19 -0600 [thread overview]
Message-ID: <87a4vv6c58.fsf@tromey.com> (raw)
In-Reply-To: <20260325123946.4072546-1-tdevries@suse.de> (Tom de Vries's message of "Wed, 25 Mar 2026 13:39:46 +0100")
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Use c_iscntrl/c_ctrl/c_unctrl instead of CTRL_CHAR/CTRL/UNCTRL, removing
Tom> redundant RUBOUT handling code.
This looks good to me but I had a small comment on the self-test.
Tom> + /* Consistency check. */
Tom> + for (unsigned int i = 0; i < 0x100; i++)
Tom> + {
Tom> + unsigned char ch = i;
Tom> + unsigned char unctrl_ch = c_unctrl (ch);
The main problem with the <ctype.h> functions is that they accept an int
but are undefined for values outside of 'unsigned char'. So calling
them with an ordinary 'char' value is bad, because on some platforms
char might be signed and so sign extension will apply.
So I think it would be valuable to test this. A simple way might be to
change this loop to iterate from -128 .. 255 and just pass that value.
This would effectively emulate both signed and unsigned char I think.
Tom
next prev parent reply other threads:[~2026-03-25 17:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 12:39 Tom de Vries
2026-03-25 17:40 ` Tom Tromey [this message]
2026-03-25 18:12 ` Tom de Vries
2026-03-25 19:45 ` Tom Tromey
2026-03-25 20:50 ` Tom Tromey
2026-03-26 9:57 ` Tom de Vries
2026-03-26 14:07 ` Tom de Vries
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=87a4vv6c58.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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