473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

longs in managed C++

Is a long in managed c++ a 64-bit number like in C#
If so how can I distinguish between that and one that's in some unmanaged code, and therefore that is 32-bit
Call it an int

Nov 17 '05 #1
6 3031
No, it is 32 bits.

Ronald Laeremans
Visual C++ team

"songie D" <an*******@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
Is a long in managed c++ a 64-bit number like in C#?
If so how can I distinguish between that and one that's in some unmanaged
code, and therefore that is 32-bit?
Call it an int?

Nov 17 '05 #2
Songie,
Is a long in managed c++ a 64-bit number like in C#?
If so how can I distinguish between that and one that's in some unmanaged code, and therefore that is 32-bit? Call it an int?


What Ronald said. Notice you can use __int64 (both in managed and unmanaged
code) to handle 64-bit numbers (or System::Int64 for just managed code)

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #3
OK, being from MSFT maybe you'll know the answer to this.
What is the reason that a long in C# is 64-bits, while a long in
MC++ is 32-bits. Is it perhaps because it is predicted that C# is
the language of the future, while MC++ is there only to provide
IJW for those that feel the need to use it (for whatever reason),
and that we'll all be moving on to 64-bit processors soon anyway
so it makes sense to use a 64-bit variable?

"Ronald Laeremans [MSFT]" <ro*****@online.microsoft.com> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl...
No, it is 32 bits.

Ronald Laeremans
Visual C++ team

"songie D" <an*******@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
Is a long in managed c++ a 64-bit number like in C#?
If so how can I distinguish between that and one that's in some unmanaged code, and therefore that is 32-bit?
Call it an int?


Nov 17 '05 #4
songie D wrote:
OK, being from MSFT maybe you'll know the answer to this.
What is the reason that a long in C# is 64-bits, while a long in
MC++ is 32-bits. Is it perhaps because it is predicted that C# is
the language of the future, while MC++ is there only to provide
IJW for those that feel the need to use it (for whatever reason),
and that we'll all be moving on to 64-bit processors soon anyway
so it makes sense to use a 64-bit variable?


I wouldn't presume to answer for Ronald, but my understanding is that
consideration of Win32/Win64 and other compatibility issues dictated int and
long remain 32 bits for the C++ compiler. It would be bad for Managed C++ to
define a larger size, because then you would throw IJW out the window. C#,
being a brand new language, had none of these concerns, but note that its
int type remains 32 bits, which is enough for most purposes. As in C++, your
primary integer data type in C# is int.

As for the future of C++ on .NET, not only is C++ not being back-burnered,
it's going to be much, much better in the next release. See this MSDN
article for more:

Write Faster Code with the Modern Language Features of Visual C++ 2005
http://msdn.microsoft.com/msdnmag/is...5/default.aspx

In some ways, such as the new support for deterministic finalization, it
will become superior to C#, and even viewed solely as a pure .NET language,
VC++ 2005 is looking very attractive.

--
Doug Harrison
Microsoft MVP - Visual C++
Nov 17 '05 #5
And you can also use the somewhat more portable "long long".

Ronald

"Tomas Restrepo (MVP)" <to****@mvps.org> wrote in message
news:e8****************@tk2msftngp13.phx.gbl...
Songie,
Is a long in managed c++ a 64-bit number like in C#?
If so how can I distinguish between that and one that's in some unmanaged

code, and therefore that is 32-bit?
Call it an int?


What Ronald said. Notice you can use __int64 (both in managed and
unmanaged
code) to handle 64-bit numbers (or System::Int64 for just managed code)

--
Tomas Restrepo
to****@mvps.org

Nov 17 '05 #6
Hi Ronald,
And you can also use the somewhat more portable "long long".


Ahh true! I had forgotten it is now supported! :)

thanks!
--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Spiggy Topes | last post by:
Hi I have a Visual Basic application that uses ADO to access an Oracle database. I have the latest 9.x ODBC drivers installed, and SQL*Plus tells me I'm looking at Oracle 8i release 8.1.7.4.1...
1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
6
by: Java and Swing | last post by:
Hi, I have been posting about writing a C extension for Python...so far, so good. At least for the "simple" functions that I need to wrap. Ok, my c function looks like... MY_NUM...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
4
by: William F. Kinsley | last post by:
My understanding is that when I re-compile a existing MFC application with the /clr switch, that the code generated is managed(with some exceptions) but that the data isn't, i.e. not garbage...
12
by: David | last post by:
Below are three classes for a console application. If put into three separate files, the sub main() will launch multiple threads adding and removing the same value. At the end we expect the value...
1
by: garyp | last post by:
Python 2.3.4 (#1, Oct 26 2004, 16:42:40) on linux2 <stdin>:1: FutureWarning: hex/oct constants sys.maxint will return positive values in Python 2.4 and up -80000000 How do I get python...
6
by: Peter | last post by:
Hi I have a number of arrays of longs, from which I need to find a single array which only contains the values which appear in all the original arrays. For example, I could have the three...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.