From: Andrew Cagney <cagney@redhat.com>
To: Stan Cox <scox@redhat.com>
Cc: Frysk List <frysk@sourceware.org>
Subject: Re: Use StringBuilder instead of PrintWriter for type display
Date: Fri, 07 Dec 2007 23:11:00 -0000 [thread overview]
Message-ID: <4759D33D.5050206@redhat.com> (raw)
In-Reply-To: <1197063360.10805.165.camel@multics.rdu.redhat.com>
Stan Cox wrote:
> This changes type display so it builds in a StringBuilder
> instead of displaying a piece at a time. Most of the changes are
> changing writer.print to stringBuilder.append. A printf style %s token
> is used to support types like
> "int (*ptr_arr) [4]" where (in this instance) the name and pointer
> info have to be inserted a printf %s string is used. For instance
> ArrayType would construct "int %s [4]" and then PointerType would
> massage that to "int (*%s) [4] and if it is member of a struct
> CompositeType would massage it to "int (*ptr_arr) [4]" (otherwise "int
> (*) [4]). This allows removal of some instanceof checks and some
> specialized code.
>
Yes, the result is much better.
Would a specialized class help: instead of a SingleString buffer, it
would contain the prefix and postfix strings, and methods to edit them.
For instance, given:
struct s {
(*foo)[10];
}
ArrayType would .append("[10]");
called by PointerType would .insert("(*", ")");
called by CompositeType would .insert("foo");
Andrew
next prev parent reply other threads:[~2007-12-07 23:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-07 21:43 Stan Cox
2007-12-07 23:11 ` Andrew Cagney [this message]
2007-12-08 0:53 ` Andrew Cagney
2007-12-10 22:00 ` Stan Cox
2007-12-10 22:08 ` Stan Cox
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=4759D33D.5050206@redhat.com \
--to=cagney@redhat.com \
--cc=frysk@sourceware.org \
--cc=scox@redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).