From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48317 invoked by alias); 18 Dec 2015 06:50:14 -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 48303 invoked by uid 89); 18 Dec 2015 06:50:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=hayden, Hx-languages-length:1072, H*Ad:U*libffi-discuss, HTo:U*libffi-discuss X-HELO: mail-wm0-f46.google.com Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 18 Dec 2015 06:50:13 +0000 Received: by mail-wm0-f46.google.com with SMTP id p187so50550206wmp.1 for ; Thu, 17 Dec 2015 22:50:12 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.111.232 with SMTP id il8mr2309545wjb.150.1450421410269; Thu, 17 Dec 2015 22:50:10 -0800 (PST) Received: by 10.194.185.74 with HTTP; Thu, 17 Dec 2015 22:50:10 -0800 (PST) In-Reply-To: References: Date: Fri, 18 Dec 2015 06:50:00 -0000 Message-ID: Subject: Re: does it matter how I construct an aggregate struct type if its size is the same? From: Hayden Livingston To: libffi-discuss@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015/txt/msg00105.txt.bz2 I understand that this maybe a systems programming general question that is not specific to libffi, but I'm asking here since I know some of you will know this and of course I'm using libffi. On Thu, Dec 17, 2015 at 10:46 PM, Hayden Livingston wrote: > This may be a fundamental question, but does it matter how a struct is > constructed if its size is accurate to the receiving function? That is > if it was made up of all int8s vs. a combination of other types? > > My scenario is that I have a receiving function whose actual struct > type information I do not know, but I know its size, so I was thinking > I could just build it up using int8 ffi_type and hope for the best. > > Is this correct in the most popular ABIs (x86, x64, arm - > windows/Linux/macosx) that all the ABI and compilers that generate > code respecting those ABI care only about size and alignment? > > I suspect so, but I'm not sure if there are quirks? Maybe on Windows? > > Thanks!