From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Subject: Re: Parsing a struct within a struct
Date: Thu, 10 Mar 2011 22:36:43 +0100 [thread overview]
Message-ID: <8739mu64k4.fsf@gnu.org> (raw)
In-Reply-To: 20110309082419.GA6429@neko
Hi Aidan,
Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
> On Tue, Mar 08, 2011 at 08:20:29PM +1300, Aidan Gauland wrote:
>> (parse-c-struct event-pointer
>> (list uint8 uint8 uint8
>> (list uint8 int int uint16 )))
>>
>
> It seemed to be an off-by-one(-byte) error. There was padding to
> align (to 32-bits, I think) the sub-struct.
>
> This works on my 32-bit machine, but I suspect it is not portable.
>
> (parse-c-struct event-pointer
> (list uint8 uint8 uint8 uint8 ; Padding
> (list uint8 int int uint16 )))
>
> What would be a better, portable solution? I suspect the `alignof'
> procedure is my friend here, but I don't understand how to use it.
The ‘alignof’ procedure was actually your enemy here. ;-)
This patch should fix it (will be in 2.0.1):
http://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=d82f8518b96bbfa4f29e03d922369c37b64824d9
Thanks!
Ludo’.
PS: Let us know when your game is ready. :-)
next prev parent reply other threads:[~2011-03-10 21:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 7:20 Parsing a struct within a struct Aidan Gauland
2011-03-09 8:24 ` Aidan Gauland
2011-03-10 21:36 ` Ludovic Courtès [this message]
2011-03-11 2:33 ` Aidan Gauland
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=8739mu64k4.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-user@gnu.org \
/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).