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=0.1 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,FREEMAIL_REPLY autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,235855e3822c83d1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.195.165 with SMTP id if5mr6683624pbc.1.1337008882160; Mon, 14 May 2012 08:21:22 -0700 (PDT) Path: pr3ni25318pbb.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Importing C function with variable argument list Date: Mon, 14 May 2012 15:21:21 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <610ee323-4c7f-413d-8568-aed4955f5152@z38g2000vbu.googlegroups.com> <1288794.275.1334249936588.JavaMail.geo-discussion-forums@ynlp2> <696103.1385.1336076109161.JavaMail.geo-discussion-forums@vbez18> Mime-Version: 1.0 Injection-Date: Mon, 14 May 2012 15:21:21 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Mda950WjNwNLAFOE7yJXQw"; logging-data="21164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199/23wP0Jp5S0cWeLxfnm0" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:920n8bWiSLgXa+X1+R2QX/Mjtho= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: 2012-05-14T15:21:21+00:00 List-Id: On 2012-05-03, sbelmont700@gmail.com wrote: > Isn't the general rule of thumb (since nothing in C is ever > well-defined) that an int is the size of the default machine word > (32-bit on 32-bit, 64 on 64, etc)? Actually it's common for 64-bit-extended i386 architecture (so-called "amd64") to have 32 bit int, since there is no speed penalty for handling 32 bit integers compared to 64 ones, but the extra memory for 64 bit integers is often wasted (and that has a direct impact on percieved speed because of caches). > If that's the case, whether it's stack or register, the calling > convention is very likely going to use an int sized argument for > anything smaller than an int anyway (e.g. if it uses the 32-bit stack, > it would have to push a one-byte char as an int-sized value anyway). Why would it? When dealing with 3 consecutive byte arguments, I don't see any reason to store them as int-sized values on the stack, on both i386-derived platforms. Natasha