all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Tom Tromey <tom@tromey.com>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Packing of union fields and bool_bf
Date: Sat, 13 Oct 2018 11:22:31 -0500	[thread overview]
Message-ID: <a48ca49b-9af3-7749-bda2-6a7b8461075c@cs.ucla.edu> (raw)
In-Reply-To: <87h8hpbzzr.fsf@tromey.com>

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

On 10/13/2018 10:58 AM, Tom Tromey wrote:
> From https://docs.microsoft.com/en-us/cpp/c-language/padding-and-alignment-of-structure-members?view=vs-2017:
>
>     Adjacent bit fields are packed into the same 1-, 2-, or 4-byte
>     allocation unit if the integral types are the same size


It's silly to require the integral types to be the same size, since the
actual size is given by the number of bits in the bitfield. But if it's
the Microsoft API we can't change it. Does the attached patch work
around the problem?


[-- Attachment #2: emacs.diff --]
[-- Type: text/x-patch, Size: 804 bytes --]

diff --git a/src/conf_post.h b/src/conf_post.h
index 683a96f936..dbe5befcf9 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -54,10 +54,10 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
     ((v) < __GNUC__ + ((w) < __GNUC_MINOR__ + ((x) <= __GNUC_PATCHLEVEL__)))
 #endif
 
-/* The type of bool bitfields.  Needed to compile Objective-C with
-   standard GCC.  It was also needed to port to pre-C99 compilers,
-   although we don't care about that any more.  */
-#if NS_IMPL_GNUSTEP
+/* The type of bool bitfields.  Preferably bool for better debugging,
+   bu unsigned int on MS-Windows to avoid struct bloat, and unsigned
+   int for Objective-C with standard GCC.  */
+#if defined DOS_NT || NS_IMPL_GNUSTEP
 typedef unsigned int bool_bf;
 #else
 typedef bool bool_bf;

  reply	other threads:[~2018-10-13 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 15:15 Packing of union fields and bool_bf Eli Zaretskii
2018-10-13 15:58 ` Tom Tromey
2018-10-13 16:22   ` Paul Eggert [this message]
2018-10-13 16:54     ` Eli Zaretskii
2018-10-13 16:43   ` 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=a48ca49b-9af3-7749-bda2-6a7b8461075c@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tom@tromey.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.
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.