public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Anthony Green <green@redhat.com>
To: Andrew Haley <aph@redhat.com>
Cc: Anthony Green <green@moxielogic.com>,
	Igor Bogomazov <ygrex@ygrex.ru>,
	       libffi-discuss@sourceware.org
Subject: Re: return value buffer malloc()'ed vs alloca()'ed
Date: Tue, 08 Oct 2013 17:40:00 -0000	[thread overview]
Message-ID: <1307910644.3010634.1381254018689.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5254428A.9080204@redhat.com>

We've had this discussion many times...

https://www.google.com/search?q=libffi+largest+integral+type&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

particularly...

http://sourceware-org.1504.n7.nabble.com/closure-api-return-value-types-problem-td201402.html

I've written it off as a wart that we must live with (so, a documentation bug).  But maybe somebody can demonstrate how to change it without impacting current users.
 
AG


----- Original Message -----
From: "Andrew Haley" <aph@redhat.com>
To: "Anthony Green" <green@moxielogic.com>
Cc: "Igor Bogomazov" <ygrex@ygrex.ru>, libffi-discuss@sourceware.org
Sent: Tuesday, October 8, 2013 1:36:10 PM
Subject: Re: return value buffer malloc()'ed vs alloca()'ed

On 10/08/2013 06:30 PM, Anthony Green wrote:
> The result
> buffer needs to be the largest native integral type on your system.
> Use a 64 bit long for rc instead of mallocing the exact return type
> size.  You can pass it into ffi_call as &rc and simply cast it to an
> int at the end.   I just checked the docs and it's definitely not
> clear

Hmmmmm.  It's not so much unclear as completely wrong.

Andrew.

  reply	other threads:[~2013-10-08 17:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 17:14 Igor Bogomazov
2013-10-08 17:30 ` Anthony Green
2013-10-08 17:36   ` Andrew Haley
2013-10-08 17:40     ` Anthony Green [this message]
2013-10-08 17:45       ` Andrew Haley
2013-10-09  5:09         ` Igor Bogomazov
2013-11-15 16:18       ` Broken tests in libffi testsuite Andrew Haley
2013-11-16 11:24         ` Alan Modra
2013-10-08 17:33 ` return value buffer malloc()'ed vs alloca()'ed Andrew Haley

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=1307910644.3010634.1381254018689.JavaMail.root@redhat.com \
    --to=green@redhat.com \
    --cc=aph@redhat.com \
    --cc=green@moxielogic.com \
    --cc=libffi-discuss@sourceware.org \
    --cc=ygrex@ygrex.ru \
    /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).