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++ / December 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 27 Dec 2006 21:38 GMT
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

Signature

Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com

Ben Voigt - 27 Dec 2006 22:42 GMT
>I have a public method in a managed class similar to void foo(int i);
>
[quoted text clipped - 3 lines]
> 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.

> Bruce
Ben Voigt - 27 Dec 2006 23:10 GMT
>>I have a public method in a managed class similar to void foo(int i);
>>
[quoted text clipped - 5 lines]
>
> 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.
>
>> Bruce
Tamas Demjen - 29 Dec 2006 18:27 GMT
> 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

Rate this thread:







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.