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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,167fc3ed1f7df035 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.227.230 with SMTP id sd6mr2238312pbc.8.1334256211666; Thu, 12 Apr 2012 11:43:31 -0700 (PDT) Path: r9ni48687pbh.0!nntp.google.com!news2.google.com!news.glorb.com!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: C's sizeof Date: Thu, 12 Apr 2012 19:42:46 +0100 Organization: A noiseless patient Spider Message-ID: References: <10939468.224.1334249018393.JavaMail.geo-discussion-forums@yngq4> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="7886"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eqVz53eFi/ZSBNfTT1rK1gxlOxUm+4yo=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:2XAYkNLW5DAsGVWHYn6Bgcz2K2I= sha1:vFCGjL5s7wyBbAingq6Pq6Aycrs= Content-Type: text/plain; charset=us-ascii Date: 2012-04-12T19:42:46+01:00 List-Id: Adam Beneschan writes: > On Thursday, April 12, 2012 9:27:09 AM UTC-7, Simon Wright wrote: >> The (draft) ARM Annex B.3[1] says at para 73 - Note 7 - >> >> "To obtain the effect of C's sizeof(item_type), where Item_Type is >> the corresponding Ada type, evaluate the expression: >> size_t(Item_Type'Size/CHAR_BIT)." >> >> Should that not be >> >> size_t((Item_Type'Size + CHAR_BIT - 1)/CHAR_BIT) >> >> ? >> >> [1] http://www.ada-auth.org/standards/12rm/html/RM-B-3.html > > Does C even support types whose sizes aren't a multiple of a byte? If > it doesn't, then since B.3 is talking about the Ada type > "corresponding" to a C type, the question is probably moot. Doesn't B.3 apply to types with Convention => C? GNAT allows type N2 is range 0 .. Integer'Last - 1; pragma Convention (C, N2); and N2'Size is 31 ...