Interfacing with c and platform dependent sizes

Jonathan M Davis jmdavisProg at gmx.com
Sun Feb 27 06:02:50 PST 2011


On Sunday 27 February 2011 05:41:49 Steven Schveighoffer wrote:
> On Sat, 26 Feb 2011 22:24:52 -0500, Bekenn <leaveme at alone.com> wrote:
> > On 2/25/2011 7:24 PM, Steven Schveighoffer wrote:
> >> BTW, I think long long is a gnu extension, it's not standard C (I don't
> >> think long long exists in Visual C for instance).
> > 
> > I'm pretty sure it's standard as of C99 (though not yet for C++; that's
> > coming with C++0x).  MSVC does indeed support it.
> 
> OK, I was not aware, my C book is from college, and I went to college in
> 94.
> 
> I always thought in Windows you had to use something like __int64.

That would be the smart thing to do, but long long does exist. IHMO, if you 
don't care about the size of an integral type in C/C++, you use int. Otherwise, 
you use a type that specifices it's size and is _guaranteed_ to be that size on 
all systems. Using types like long and long long is just asking for it. 
Fortunately, D specifies the size of its types, so that isn't a problem.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list