From: Mark H Weaver <mhw@netris.org>
To: "Thompson\, David" <dthompson2@worcester.edu>
Cc: Andy Wingo <wingo@pobox.com>, guile-devel <guile-devel@gnu.org>
Subject: Re: Attempting to unbox struct fields
Date: Sun, 28 Feb 2016 22:56:14 -0500 [thread overview]
Message-ID: <87h9gscgpt.fsf@netris.org> (raw)
In-Reply-To: <CAJ=RwfayrPQMXLrHZudMT0vCvEdL=2AYuTrTYrKHm0cQO_eHGA@mail.gmail.com> (David Thompson's message of "Sun, 28 Feb 2016 16:30:21 -0500")
Hi David,
"Thompson, David" <dthompson2@worcester.edu> writes:
> Here's a patch I came up with to enable (and fix where necessary) the
> support for signed integer and double struct fields.
Great, thanks for working on it! This is not a proper review, just a
couple of questions and comments.
> Am I on the right track here?
The first thing I noticed is that the patch assumes that doubles are the
same size as pointers. Obviously this is not the case on 32-bit
systems. What's the plan for those systems?
The patch also currently assumes that longs and pointers are the same
size, and this turns out to be false on LLP64 systems such as 64-bit
Windows. See <https://debbugs.gnu.org/22406>. However, it should be
straightforward to fix this issue.
> + if ((prot != 'r' && prot != 'w') || inits_idx == n_inits)
> + *mem = 0.0;
Note that 'mem' is of type scm_t_bits*, so the 0.0 will be converted to
the integer 0 and then stored as an integer, which I guess is not what
you meant. Note that in practice this works on IEEE 754 systems, where
0.0 is represented as all zero bits, but the code is somewhat misleading
and less portable than it could be.
Thanks,
Mark
next prev parent reply other threads:[~2016-02-29 3:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-28 15:03 Attempting to unbox struct fields David Thompson
2016-02-28 21:30 ` Thompson, David
2016-02-29 3:56 ` Mark H Weaver [this message]
2016-02-29 14:26 ` Thompson, David
2016-02-29 17:43 ` Mark H Weaver
2016-02-29 21:09 ` Thompson, David
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h9gscgpt.fsf@netris.org \
--to=mhw@netris.org \
--cc=dthompson2@worcester.edu \
--cc=guile-devel@gnu.org \
--cc=wingo@pobox.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).