From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72232 invoked by alias); 22 Oct 2017 21:38:40 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 72221 invoked by uid 89); 22 Oct 2017 21:38:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=anticipate, Hx-languages-length:1099 X-HELO: smtp-out-so.shaw.ca Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.139) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 22 Oct 2017 21:38:38 +0000 Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP id 6Nx4e0aIDDJTW6Nx5e6azZ; Sun, 22 Oct 2017 15:38:36 -0600 X-Authority-Analysis: v=2.2 cv=B4DJ6KlM c=1 sm=1 tr=0 a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=02M-m0pO-4AA:10 a=4GLjRUZkb2dOzAB6VcUA:9 a=QEXdDO2ut3YA:10 Received: from www-data by kylheku.com with local (Exim 4.72) (envelope-from <382-725-6798@kylheku.com>) id 1e6Nx4-0006Zy-5V; Sun, 22 Oct 2017 14:38:34 -0700 To: Bruno Haible Subject: Re: small return types X-PHP-Originating-Script: 501:rcmail.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Date: Sun, 22 Oct 2017 21:38:00 -0000 From: "Kaz Kylheku (libffi)" <382-725-6798@kylheku.com> Cc: libffi-discuss@sourceware.org In-Reply-To: <5182570.xx5xnuqjYz@omega> References: <2437301.0N14NqkuRT@omega> <5182570.xx5xnuqjYz@omega> Message-ID: <55d074869d04452303ab2c859a311130@mail.kylheku.com> X-Sender: 382-725-6798@kylheku.com User-Agent: Roundcube Webmail/0.9.2 X-CMAE-Envelope: MS4wfP9FKZZPrC20ug5myC8flrZygV7iOr6od41pHZvAg1ZjNwkQbv6YPYuy4bQrssrYEUDCx9QSW0mbETrhMllkmXFRL+rwXZyvUzFwxU0ykWN3z4Prdo2J iZ1mjf6LLT0B3VmqsM2UFIFzCGuMmPa1F9ri7vlvRrE54R4rYnVqETiOAEYPjMclJ5bsi3GEZpr5r/VbHUhQjPTFGoo5xz6SKAM= X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00026.txt.bz2 On 22.10.2017 13:33, Bruno Haible wrote: > The new documentation says: >=20 > +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. >=20 > Which is not useful, because the point of using a library such as=20 > libffi > is to NOT NEED TO KNOW about the ABI, about the width of system=20 > 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=20 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.