From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128104 invoked by alias); 18 Dec 2015 11:08:33 -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 128091 invoked by uid 89); 18 Dec 2015 11:08:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HTo:U*libffi-discuss X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Dec 2015 11:08:31 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id A32C8C0AEE3A for ; Fri, 18 Dec 2015 11:08:30 +0000 (UTC) Received: from zebedee.pink (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBIB8Tc2000715; Fri, 18 Dec 2015 06:08:30 -0500 Subject: Re: does it matter how I construct an aggregate struct type if its size is the same? To: libffi-discuss@sourceware.org References: From: Andrew Haley Message-ID: <5673E92C.7090400@redhat.com> Date: Fri, 18 Dec 2015 11:08:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015/txt/msg00106.txt.bz2 On 18/12/15 06:46, 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? Yes, it does. But there is a specific exception for character types: a character type is permitted to alias all other types. So it's always safe to use an array of char, say, to hold anything. (Without this rule, malloc() would not work.) Andrew.