Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

longs in managed C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
songie D - 11 May 2004 11:56 GMT
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
Ronald Laeremans [MSFT] - 11 May 2004 23:24 GMT
No, it is 32 bits.

Ronald Laeremans
Visual C++ team

> 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?
songie D - 12 May 2004 20:38 GMT
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?

> No, it is 32 bits.
>
[quoted text clipped - 5 lines]
> > code, and therefore that is 32-bit?
> > Call it an int?
Doug Harrison [MVP] - 12 May 2004 21:45 GMT
>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
[quoted text clipped - 3 lines]
>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/issues/04/05/VisualC2005/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.

Signature

Doug Harrison
Microsoft MVP - Visual C++

Tomas Restrepo \(MVP\) - 12 May 2004 03:44 GMT
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)

Signature

Tomas Restrepo
tomasr@mvps.org

Ronald Laeremans [MSFT] - 12 May 2004 22:02 GMT
And you can also use the somewhat more portable "long long".

Ronald

> Songie,
>> Is a long in managed c++ a 64-bit number like in C#?
[quoted text clipped - 5 lines]
> unmanaged
> code) to handle 64-bit numbers (or System::Int64 for just managed code)
Tomas Restrepo \(MVP\) - 13 May 2004 00:49 GMT
Hi Ronald,

> And you can also use the somewhat more portable "long long".

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

thanks!
Signature

Tomas Restrepo
tomasr@mvps.org


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.