C# Convention Question

Started by
12 comments, last by yaroslavd 20 years, 1 month ago
I use C# quite a bit (basically except on projects where the language is defined by the project) and I have yet to use the System.Int*, System.Double, etc. definitions. They''re there because they exist, but there is never a need to use them.
Advertisement
quote:Original post by haro
I''d assume that int would reference the most logical integer data type for the particular architecture that your code is running on. For a 64 bit architecture this would most likely be a 64 bit value, as opposed to a 32.

Assume nothing.
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
If I may recommend, if you want integer aliasing that is platform dependent you can use the preprocessor to define them.

#if PLATFORM_64
using size_t = System.UInt64;
#else
using size_t = System.UInt32;
#endif

Of course when doing this you need to be aware of what the different requirements do to your program, but there are reasons to want this behavior.
------http://www.livejournal.com/users/rain_is_wet/
quote:Original post by levendis
If I may recommend, if you want integer aliasing that is platform dependent you can use the preprocessor to define them.

#if PLATFORM_64
using size_t = System.UInt64;
#else
using size_t = System.UInt32;
#endif

Of course when doing this you need to be aware of what the different requirements do to your program, but there are reasons to want this behavior.


System.IntPtr?

[How To Ask Questions|STL Programmer''s Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]

This topic is closed to new replies.

Advertisement