This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] don't allocate serial_ops
- From: Yao Qi <yao at codesourcery dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Mon, 9 Dec 2013 14:13:06 +0800
- Subject: Re: [PATCH 2/2] don't allocate serial_ops
- Authentication-results: sourceware.org; auth=none
- References: <1386356956-9855-1-git-send-email-tromey at redhat dot com> <1386356956-9855-3-git-send-email-tromey at redhat dot com>
On 12/07/2013 03:09 AM, Tom Tromey wrote:
Now that struct serial_ops is const everywhere, we can easily turn the
instances into globals. This patch implements this idea.
Is it better to turn them into static locals of _initialize_ser_XXX
functions?
On the one hand I think this is nicer since it makes a bit more data
readonly and slightly reduces allocations. On the other hand it
reduces readability somewhat.
If the readability is a concern to anyone I was thinking I could write
a macro that conditionally uses GCC's designated initializer
extension.
The patched code is still quite readable to me.
--
Yao (éå)