Should I be using int or Int16 for the paramaters for my assemblymethods?

B

Bruce

I have a public method in a managed class similar to void foo(int i);

I noticed something a bit curious when I complied the help file with
Sandcastle. Sandcastle is seeing the int parameters as Int32.

Should I not be using int but use Int16 so that the parameter is
compatible across all of the languages?

Bruce
 
B

Ben Voigt

Bruce said:
I have a public method in a managed class similar to void foo(int i);

I noticed something a bit curious when I complied the help file with
Sandcastle. Sandcastle is seeing the int parameters as Int32.

Should I not be using int but use Int16 so that the parameter is
compatible across all of the languages?

int is Int32 in .NET, and long is Int64. short is Int16.

You may be confusing int with VB6's Integer, which was 16 bits.
 
B

Ben Voigt

Ben Voigt said:
int is Int32 in .NET, and long is Int64. short is Int16.

Arggh! That's for C# and VB.NET. In C++/CLI, long is still a synonym for
int, and __int64 is the keyword corresponding to System::Int64 (and there is
also __int128).
You may be confusing int with VB6's Integer, which was 16 bits.
 
T

Tamas Demjen

Ben said:
Arggh! That's for C# and VB.NET. In C++/CLI, long is still a synonym for
int, and __int64 is the keyword corresponding to System::Int64 (and there is
also __int128).

I would like to add that there's a new 64-bit integer type called long
long, which was introduced to replace the non-standard and awkward
__int64 type. I personally prefer long long or System::Int64 to __int64.
long long is part of C99 and will be part of ISO C++0x.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top