From: Keith Thompson <kst-u@mib.org>
Subject: Re: Interfacing to C and long long data type
Date: 25 Jun 2008 09:55:32 -0700
Date: 2008-06-25T09:55:32-07:00 [thread overview]
Message-ID: <lz1w2lwj23.fsf@stalkings.ghoti.net> (raw)
In-Reply-To: fcff078f-e53d-4560-a275-3d2620f1d34e@w7g2000hsa.googlegroups.com
Maciej Sobczak <see.my.homepage@gmail.com> 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 <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
next prev parent reply other threads:[~2008-06-25 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-25 15:23 Interfacing to C and long long data type Maciej Sobczak
2008-06-25 16:55 ` Keith Thompson [this message]
2008-06-25 21:35 ` Maciej Sobczak
2008-06-26 8:53 ` Sébastien Morand
2008-06-26 10:19 ` Georg Bauhaus
2008-06-26 11:59 ` Maciej Sobczak
2008-06-27 14:31 ` Sébastien Morand
2008-06-27 16:11 ` Dmitry A. Kazakov
2008-06-27 18:53 ` Adam Beneschan
2008-06-27 20:29 ` Simon Wright
2008-06-27 20:46 ` Dmitry A. Kazakov
2008-06-25 19:08 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox