Re: Is __int64 dead?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



One question has an answer:
Come to think of it - does C++ define *any* types which are guaranteed to be a fixed number of bytes on ALL platforms?

Yes. Types char, signed char, and unsigned char are all guaranteed to be 1 byte long on all platforms.

(This is why we have to remember that "char" != "character".)


"David Webber" <dave@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:OxMs1Wv5HHA.5844@xxxxxxxxxxxxxxxxxxxxxxx

"Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx> wrote in message news:Oo9lAnq5HHA.1208@xxxxxxxxxxxxxxxxxxxxxxx

I would expect Microsoft to continue to support __int64 whether it's considered part of the ANSI standard or not.

For my personal tastes, I see long long int, and think something along the lines of "now, what size is int on this platform? And so what size is the long? And what does that make long int, and long long int?" If I need a 64-bit data types regardless of the platform I'm compiling to, I use __int64.

I use __int64 a lot too. I have a need for something to hold a set of 64 bit flags in a number of places.

unsigned __int64 does the job.

I also occasionally use unsigned __int32 __int16 and __int8 where the number of bits is important to me. If they weren't there, I'd use DWORD WORD and BYTE (as I do in other contexts), but IIRC those are Microsoft specific too.

Come to think of it - does C++ define *any* types which are guaranteed to be a fixed number of bytes on ALL platforms?

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm







.



Relevant Pages

  • Re: size_t - why?
    ... A char is CHAR_BIT bits, ... An int is at least 16 bits (the minimum value it can hold must ... > small platforms where single objects cannot exceed a certain size, ... All clear now - and thanks for the stds ...
    (comp.lang.c)
  • Re: Binary-mode i/o, width of char, endianness
    ... > The second option is to allocate the input buffer as simply one int ... > object that is guaranteed to be at least 24 bits wide: the long int, ... On platforms such as the kind you are worrying about ... I would stick to unsigned char for this project. ...
    (comp.lang.c)
  • Re: Runtime errors possible when I forgot include
    ... > that is return value is supposed to be int and parameters are converted using ... > If implicit conversion between int and char* is unsafe < ... 64-bit platforms now still have 32-bit int, and then there's still the odd LP32 ...
    (comp.lang.c)
  • Re: [PATCH] pci-sysfs: backport fix for 2.6.11.12
    ... > char is signed and 8 bit wide on all platforms with gcc. ... no. char is signed on x86 and unsigned on ppc. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: wchar_t
    ... wchar_t) or logical range (i.e. what values are legal for "wide characters" ... On other platforms situation may or may not be different. ... functions which unfortunately are not compile-time constants. ... (Also note that your assertion about char range being from -128 to 127 is ...
    (microsoft.public.vc.language)