Discussion:
The lomg long type in 64-bit address mode.
(too old to reply)
Vladimir Grigoriev
2009-10-14 14:32:31 UTC
Permalink
Just a qyestion: In a 64-bit address mode the long long type is usually
equal to the long type?

Vladimir Grigoriev
Victor Bazarov
2009-10-14 15:59:22 UTC
Permalink
Post by Vladimir Grigoriev
Just a qyestion: In a 64-bit address mode the long long type is usually
equal to the long type?
No. 'long' is 4 bytes, 'long long' is 8.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Vladimir Grigoriev
2009-10-14 17:45:48 UTC
Permalink
Victor, are you sure? In some 64-bit address mode systems long is 8-bytes.
However I do not know yet what about the long long type..

Vladimir Grigoriev
Post by Victor Bazarov
Post by Vladimir Grigoriev
Just a qyestion: In a 64-bit address mode the long long type is usually
equal to the long type?
No. 'long' is 4 bytes, 'long long' is 8.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jochen Kalmbach [MVP]
2009-10-14 18:06:52 UTC
Permalink
Hallo Vladimir!
Post by Vladimir Grigoriev
Victor, are you sure? In some 64-bit address mode systems long is 8-bytes.
However I do not know yet what about the long long type..
http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Ulrich Eckhardt
2009-10-15 06:55:32 UTC
Permalink
Post by Vladimir Grigoriev
Victor, are you sure? In some 64-bit address mode systems long is 8-bytes.
MS Windows is unfortunately not one of them, they decided that long shall
keep its size on both 32 and 64 bit platforms.
Post by Vladimir Grigoriev
However I do not know yet what about the long long type..
The long long type defined by C99 is at least 64 bits. Even for win64 it is
not bigger.

Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Vladimir Grigoriev
2009-10-15 11:23:01 UTC
Permalink
Thanks, Ulrich. Yesterday I knew that on IBM 64-bit platform long and long
long both are 8 bytes.

Vladimir Grigoriev
Post by Ulrich Eckhardt
Post by Vladimir Grigoriev
Victor, are you sure? In some 64-bit address mode systems long is 8-bytes.
MS Windows is unfortunately not one of them, they decided that long shall
keep its size on both 32 and 64 bit platforms.
Post by Vladimir Grigoriev
However I do not know yet what about the long long type..
The long long type defined by C99 is at least 64 bits. Even for win64 it is
not bigger.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschaftsfuhrer: Thorsten Focking, Amtsgericht Hamburg HR B62 932
Ben Voigt [C++ MVP]
2009-10-16 00:18:39 UTC
Permalink
Post by Ulrich Eckhardt
Post by Vladimir Grigoriev
Victor, are you sure? In some 64-bit address mode systems long is 8-bytes.
MS Windows is unfortunately not one of them, they decided that long shall
keep its size on both 32 and 64 bit platforms.
More correct to say: Visual C++ is not one of them. Size of C and C++
integral types is set by the compiler manufacturer.

On the other hand, LONG, which is defined by the windows API, is always
32-bits. But long can vary.



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4512 (20091015) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Tim Roberts
2009-10-16 05:05:10 UTC
Permalink
Post by Vladimir Grigoriev
Victor, are you sure? In some 64-bit address mode systems long is 8-bytes.
However I do not know yet what about the long long type..
Both of you are correct. In some 64-bit systems, long is 8 bytes. In gcc,
for example, "long" is 8 bytes in 64-bit systems, while "int" is 4 bytes.

Microsoft happens to have chosen to set both "int" and "long" to 4 bytes in
both 32-bit and 64-bit systems.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Ulrich Eckhardt
2009-10-16 06:47:41 UTC
Permalink
Post by Tim Roberts
Both of you are correct. In some 64-bit systems, long is 8 bytes.
In gcc, for example, "long" is 8 bytes in 64-bit systems, while "int" is
4 bytes.
Actually, that's not completely true. A win64-port must also use a 4-byte
long type and an 8-byte long long type. As you say, it depends on the
system.

Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Ben Voigt [C++ MVP]
2009-10-16 16:42:14 UTC
Permalink
Post by Ulrich Eckhardt
Post by Tim Roberts
Both of you are correct. In some 64-bit systems, long is 8 bytes.
In gcc, for example, "long" is 8 bytes in 64-bit systems, while "int" is
4 bytes.
Actually, that's not completely true. A win64-port must also use a 4-byte
long type and an 8-byte long long type. As you say, it depends on the
system.
Actually I think it only has to provide matching winbase.h which sets the
macro LONG properly (using a 32-bit signed integer type), with no
restrictions on the C++ keyword "long".
Post by Ulrich Eckhardt
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Tim Roberts
2009-10-17 19:47:51 UTC
Permalink
Post by Ulrich Eckhardt
Post by Tim Roberts
Both of you are correct. In some 64-bit systems, long is 8 bytes.
In gcc, for example, "long" is 8 bytes in 64-bit systems, while "int" is
4 bytes.
Actually, that's not completely true. A win64-port must also use a 4-byte
long type and an 8-byte long long type.
Not so. The 64-bit gcc compiler, even when running on Windows, defines
"long" as an 8-byte type.

That has implications if you hope to use SDK include files. It means you
must make sure that you have this somewhat unintuitive set of definitions:

typedef int LONG, *PLONG;
typedef unsigned int ULONG, *PULONG;
Post by Ulrich Eckhardt
As you say, it depends on the system.
It depends on the COMPILER.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
k***@gmail.com
2009-10-18 19:55:47 UTC
Permalink
See "Data model": http://www.viva64.com/terminology/Data_model.html
Loading...