From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,642c983bc89db880,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!v67g2000hse.googlegroups.com!not-for-mail From: okellogg Newsgroups: comp.lang.ada Subject: pragma Pack vs. Convention C, portability issue? Date: Wed, 9 Jan 2008 00:40:50 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 53.122.197.194 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1199868050 21757 127.0.0.1 (9 Jan 2008 08:40:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 Jan 2008 08:40:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v67g2000hse.googlegroups.com; posting-host=53.122.197.194; posting-account=a23u_AkAAAB-Xz81hSqodYsmJRrMwioK User-Agent: G2/1.0 X-HTTP-Via: 1.1 DEIPROXY01 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19289 Date: 2008-01-09T00:40:50-08:00 List-Id: -- File: main.adb -- Can we portably rely on pragma Pack taking precedence -- over Convention C? with Text_IO; procedure Main is type C_Represented_Enum is (Zero, One, Two, Three); pragma Convention (C, C_Represented_Enum); -- This would be 32 bits on a 32 bit architecture type Perhaps_Packed is array (1 .. 4) of C_Represented_Enum; pragma Pack (Perhaps_Packed); -- This could be either 8 bits if the compiler lets pragma Pack -- take precedence over Convention C, or 4 * 32 = 128 bits -- otherwise. begin Text_IO.Put_Line ("Perhaps_Packed'Size is" & Natural'Image (Perhaps_Packed'Size)); end Main;