long vs. Int64 
Author Message
 long vs. Int64

I want to convert a numeric string to a 'long', and I use the following
code:

long  l_number  = Int64::Parse(  numeric_string  ) ;

This generates a warning error ala losing info fro converting an 'Int64' to
a 'long'. First, I thought they were basically the same thing (there is no
.NET Framework 'long' class that I've found). Second, there must be a way to
prevent this from generating a warning. Or, put another way, there must be a
way of converting a 'numeric_string' to it's 'long' equivalent without
generating a warning error...

Thanks in advance...!

   /== Peteroid ==\



Thu, 27 Jan 2005 03:33:22 GMT  
 long vs. Int64

Quote:
> I want to convert a numeric string to a 'long', and I use the following
> code:

> long  l_number  = Int64::Parse(  numeric_string  ) ;

> This generates a warning error ala losing info fro converting an 'Int64'
to
> a 'long'. First, I thought they were basically the same thing (there is no
> .NET Framework 'long' class that I've found). Second, there must be a way
to
> prevent this from generating a warning. Or, put another way, there must be
a
> way of converting a 'numeric_string' to it's 'long' equivalent without
> generating a warning error...

In C#, the long maps to Int64, however in VC, long is 32 bit.

Ken



Thu, 27 Jan 2005 03:46:58 GMT  
 long vs. Int64

Quote:
> I want to convert a numeric string to a 'long', and I use the following
> code:

> long  l_number  = Int64::Parse(  numeric_string  ) ;

> This generates a warning error ala losing info fro converting an 'Int64'
to
> a 'long'. First, I thought they were basically the same thing (there is no
> .NET Framework 'long' class that I've found). Second, there must be a way
to
> prevent this from generating a warning. Or, put another way, there must be
a
> way of converting a 'numeric_string' to it's 'long' equivalent without
> generating a warning error...

The C++ type 'long' is only 32 bits.  Use Int32::Parse() instead & the
warning will go away.  Or, if you want a 64-bit result, you need to use the
C++ type __int64.

-cd



Thu, 27 Jan 2005 03:48:58 GMT  
 long vs. Int64
Peteroid,
In Visual C++ a long is a 32bit number (System::Int32). Moving an Int64 into
it will loose info...

You will need to use either __int64 or System::Int64.

Or if you really want a long use Int32::Parse.

Hope this helps
Jay


Quote:
> I want to convert a numeric string to a 'long', and I use the following
> code:

> long  l_number  = Int64::Parse(  numeric_string  ) ;

> This generates a warning error ala losing info fro converting an 'Int64'
to
> a 'long'. First, I thought they were basically the same thing (there is no
> .NET Framework 'long' class that I've found). Second, there must be a way
to
> prevent this from generating a warning. Or, put another way, there must be
a
> way of converting a 'numeric_string' to it's 'long' equivalent without
> generating a warning error...

> Thanks in advance...!

>    /== Peteroid ==\



Thu, 27 Jan 2005 03:49:38 GMT  
 long vs. Int64
Thanx all! There was a typo in a book I'm using that says longs are int64.
Doh! Thanx again! :)

  /== Peteroid ==\


Quote:
> I want to convert a numeric string to a 'long', and I use the following
> code:

> long  l_number  = Int64::Parse(  numeric_string  ) ;

> This generates a warning error ala losing info fro converting an 'Int64'
to
> a 'long'. First, I thought they were basically the same thing (there is no
> .NET Framework 'long' class that I've found). Second, there must be a way
to
> prevent this from generating a warning. Or, put another way, there must be
a
> way of converting a 'numeric_string' to it's 'long' equivalent without
> generating a warning error...

> Thanks in advance...!

>    /== Peteroid ==\



Thu, 27 Jan 2005 04:57:43 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. int vs (int16, int32, int64, etc)

2. long vs unsigned long

3. UINT, LONG vs. unsigned, long

4. long long vs. __int64

5. char size (was long long long long long int)

6. Conversion of signed long int to n-bit signed int and vs vs

7. long long long long integers

8. short/long/long long Formatting questions

9. Long long and long double

10. long long vs. long?

11. long double in c vs. fortran

12. floats/shorts vs double/longs

 

 
Powered by phpBB® Forum Software