Posts tagged Integer (computer science)

What is the difference between int and System::Int32

Some may say identical, at least that’s what the Visual C++ compiler tells you at the first glance  when you turn on /oldsyntax public __gc class Class1 { public: void F1(int a){} void F1(System::Int32 a){} //Error    2    error  2535:  void Class1::F1(int)’ : member function already defined or declared } Okay, so if I add & to the parameter types I should get the same error right?void F1(int&a){} void F1(System::Int32& a){} Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped Wait, didn’t I get an error just now? You are right, somehow the compiler treat the two types differently when passing by reference. look at the function signatures in MSIL. Int32 is passed by reference as expected

Read more ...