From: Andreas Rottmann <a.rottmann@gmx.at>
To: Nix <nix@esperi.org.uk>
Cc: Paul Eggert <eggert@cs.ucla.edu>,
Dmitry Antipov <dmantipov@yandex.ru>,
Stefan Monnier <monnier@iro.umontreal.ca>,
Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: [RFC, PATCH] shrink struct vectorlike_header #2
Date: Fri, 09 Nov 2012 19:04:42 +0100 [thread overview]
Message-ID: <87wqxuac05.fsf@delenn.home.rotty.xx.vu> (raw)
In-Reply-To: <87sj8kng9f.fsf@spindle.srvr.nix> (nix@esperi.org.uk's message of "Thu, 08 Nov 2012 17:42:04 +0000")
Nix <nix@esperi.org.uk> writes:
> On 8 Nov 2012, Paul Eggert spake thusly:
>> But better yet would be to omit the casts entirely.
>> This might let GCC do more optimizations safely. That is,
>> change struct Lisp_Vector to be something like this:
>>
>> struct Lisp_Vector
>> {
>> struct vectorlike_header header;
>> union
>> {
>> Lisp_Object contents[1];
>> struct Lisp_Vector *next;
>> } u;
>> };
>>
>> Replace all current uses of 'contents'
>> with 'u.contents', and then use u.next
>> when you want to use the memory as a next field.
>
> It's a shame we can't use an unnamed union here:
>
> struct Lisp_Vector
> {
> struct vectorlike_header header;
> union
> {
> Lisp_Object contents[1];
> struct Lisp_Vector *next;
> };
> };
>
> No changes to source necessary.
>
> Downside: GCC extension :( which probably rules it out unless wrapped in
> compiler-specific macro trickery, and if you're doing that you might as
> well just unconditionally use a named union.
>
At least according to Wikipedia[0], anonymous unions and structs are
part of C11, so they're not compiler-specific any longer. However,
given the newness of C11, similiar considerations regarding portability
to non-GCC compilers may still apply.
[0] http://en.wikipedia.org/wiki/C11_(C_standard_revision)
Regards, Rotty
--
Andreas Rottmann -- <http://rotty.xx.vu/>
next prev parent reply other threads:[~2012-11-09 18:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 6:41 [PATCH] shrink struct vectorlike_header Dmitry Antipov
2012-10-11 12:57 ` Stefan Monnier
2012-11-06 17:09 ` [RFC, PATCH] shrink struct vectorlike_header #2 Dmitry Antipov
2012-11-06 18:17 ` Stefan Monnier
2012-11-07 14:57 ` Dmitry Antipov
2012-11-08 3:08 ` Stefan Monnier
2012-11-08 5:25 ` Paul Eggert
2012-11-08 13:31 ` Dmitry Antipov
2012-11-08 14:03 ` Stefan Monnier
2012-11-08 14:45 ` Dmitry Antipov
2012-11-08 15:08 ` Dmitry Antipov
2012-11-08 16:30 ` Paul Eggert
2012-11-08 17:12 ` Andreas Schwab
2012-11-08 17:42 ` Nix
2012-11-09 18:04 ` Andreas Rottmann [this message]
2012-11-08 6:56 ` Stephen J. Turnbull
2012-11-06 20:53 ` Paul Eggert
2012-11-06 21:28 ` Eli Zaretskii
2012-10-11 16:42 ` [PATCH] shrink struct vectorlike_header Eli Zaretskii
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=87wqxuac05.fsf@delenn.home.rotty.xx.vu \
--to=a.rottmann@gmx.at \
--cc=dmantipov@yandex.ru \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=nix@esperi.org.uk \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.