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,995362da150dc3a9 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeeder.dynfx.net!weretis.net!news.k-dsl.de!aioe.org!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Interfacing to C and long long data type Date: 25 Jun 2008 09:55:32 -0700 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: udTJGbGWl+bx22XXwco3hA.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Xref: g2news1.google.com comp.lang.ada:878 Date: 2008-06-25T09:55:32-07:00 List-Id: Maciej Sobczak writes: > C has a long long data type, which is supposed to be at least as big > as long. Recently, the same data type is being added to C++ as well > (they were working on it for a long long time). In addition, long long is required to be at least 64 bits wide (long is required to be at least 32 bits wide). > The problem is that there is no corresponding type in Interfaces.C. > > Is it possible to interface with C APIs that use long long? You can declare type C_Long_Long is range -2**63 .. 2**63-1; It's not guaranteed to match C's long long, but I've never heard of a C implementation where long long is anything other than exactly 64 bits. There's also "unsigned long long", which you can declare in Ada as: type C_Unsigned_Long_Long is mod 2**64; Note that "long long" and "unsigned long long" were introduced in the 1999 ISO C standard, which is fully implemented by only a handful of C compilers. Many pre-C99 compilers support "long long" as an extension, but there are still some that don't. > Similar issue exists with long long double. Not really, because there is no "long long double" type in C or C++. There's "long double", but that's been in C since at least the 1989 standard, and I presume there's already a corresponding type in Interfaces.C. (C and C++ have 3 floating-point types: "float", "double", and "long double".) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"