From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36762 invoked by alias); 18 Dec 2015 06:47:01 -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 36751 invoked by uid 89); 18 Dec 2015 06:46:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*libffi-discuss, HTo:U*libffi-discuss X-HELO: mail-wm0-f44.google.com Received: from mail-wm0-f44.google.com (HELO mail-wm0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 18 Dec 2015 06:46:58 +0000 Received: by mail-wm0-f44.google.com with SMTP id p187so52061913wmp.0 for ; Thu, 17 Dec 2015 22:46:57 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.28.195.138 with SMTP id t132mr963222wmf.86.1450421215294; Thu, 17 Dec 2015 22:46:55 -0800 (PST) Received: by 10.194.185.74 with HTTP; Thu, 17 Dec 2015 22:46:55 -0800 (PST) Date: Fri, 18 Dec 2015 06:47:00 -0000 Message-ID: Subject: 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/msg00104.txt.bz2 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!