This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: small return types
- From: "Kaz Kylheku (libffi)" <382-725-6798 at kylheku dot com>
- To: Bruno Haible <bruno at clisp dot org>
- Cc: libffi-discuss at sourceware dot org
- Date: Sun, 22 Oct 2017 14:38:34 -0700
- Subject: Re: small return types
- Authentication-results: sourceware.org; auth=none
- References: <2437301.0N14NqkuRT@omega> <d0041aa4ade72ea0f4e1d6693b283385@mail.kylheku.com> <5182570.xx5xnuqjYz@omega>
On 22.10.2017 13:33, Bruno Haible wrote:
The new documentation says:
+That is, in most cases, @var{ret} points to an object of exactly the
+size of the type specified when @var{cif} was constructed. However,
+integral types narrower than the system register size are widened.
Which is not useful, because the point of using a library such as
libffi
is to NOT NEED TO KNOW about the ABI, about the width of system
registers
etc.
Unfortunately, that's the library interface that a test suite has
to exercise, and not the ideal one that we would like to exist in
it place.
This cannot be fixed without breaking correctly implemented programs
which follow the scheme.
Using the API right is slightly ugly but not a major complication.
My FFI implementation experience shows that it can be absorbed in a
design which didn't anticipate the issue at all, and in a reasonably
localized
way which hides it from the higher levels.
The register size is abstracted by the ffi_arg type; applications don't
have to depend on how specific sizes in specific ways.