Thread: [Dev-C++] Need to improve surpport for STL?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Justin F. <jus...@gm...> - 2004-12-21 07:47:12
|
Hi, all I just read a article from CSDN, http://community.csdn.net/Expert/topic/3662/3662092.xml?temp=.1579553 since its language is Chinese, so I just copy the source file here and list the result. Please compare the result generated by Dev-C++ from VS 2003. How do you think about it? Source Code: #include <iostream> #include <typeinfo> template<typename T> class Type { public: static void print() { std::cout << "This Type is " << typeid(T).name() << ", It's size = " << sizeof(T) << "." << std::endl; } }; struct Polymorph { virtual ~Polymorph() {} }; enum Bit { sero, one }; enum Intensity { black = 0, brightest = 1000 }; int main() { Type<bool>::print(); Type<char>::print(); Type<signed char>::print(); Type<unsigned char>::print(); Type<wchar_t>::print(); Type<short int>::print(); Type<signed short int>::print(); Type<unsigned short int>::print(); Type<int>::print(); Type<signed int>::print(); Type<unsigned int>::print(); Type<long int>::print(); Type<signed long int>::print(); Type<unsigned long int>::print(); Type<long long int>::print(); Type<signed long long int>::print(); Type<unsigned long long int>::print(); Type<float>::print(); Type<double>::print(); Type<long double>::print(); Type<int *>::print(); Type<int (*)()>::print(); Type<void (Polymorph::*)()>::print(); Type<void*>::print(); Type<Bit>::print(); Type<Intensity>::print(); return 0; } The result from Dev-C++: This Type is b, It's size = 1. This Type is c, It's size = 1. This Type is a, It's size = 1. This Type is h, It's size = 1. This Type is w, It's size = 2. This Type is s, It's size = 2. This Type is s, It's size = 2. This Type is t, It's size = 2. This Type is i, It's size = 4. This Type is i, It's size = 4. This Type is j, It's size = 4. This Type is l, It's size = 4. This Type is l, It's size = 4. This Type is m, It's size = 4. This Type is x, It's size = 8. This Type is x, It's size = 8. This Type is y, It's size = 8. This Type is f, It's size = 4. This Type is d, It's size = 8. This Type is e, It's size = 12. This Type is Pi, It's size = 4. This Type is PFivE, It's size = 4. This Type is M9PolymorphFvvE, It's size = 8. This Type is Pv, It's size = 4. This Type is 3Bit, It's size = 4. This Type is 9Intensity, It's size = 4. The result from VS2003: This Type is bool, It's size = 1. This Type is char, It's size = 1. This Type is signed char, It's size = 1. This Type is unsigned char, It's size = 1. This Type is unsigned short, It's size = 2. This Type is short, It's size = 2. This Type is short, It's size = 2. This Type is unsigned short, It's size = 2. This Type is int, It's size = 4. This Type is int, It's size = 4. This Type is unsigned int, It's size = 4. This Type is long, It's size = 4. This Type is long, It's size = 4. This Type is unsigned long, It's size = 4. This Type is __int64, It's size = 8. This Type is __int64, It's size = 8. This Type is unsigned __int64, It's size = 8. This Type is float, It's size = 4. This Type is double, It's size = 8. This Type is long double, It's size = 8. This Type is int *, It's size = 4. This Type is int (__cdecl*)(void), It's size = 4. This Type is void (__thiscall Polymorph::*)(void), It's size = 4. This Type is void *, It's size = 4. This Type is enum Bit, It's size = 4. This Type is enum Intensity, It's size = 4. -- Thanks Z.J. |
|
From: Per W. <pw...@ia...> - 2004-12-21 12:13:52
|
Can't see why the STL support should need to improve. The first difference is the names of all types - especially for built-in data types. I can't see that this is in violation of the standard. All different data types still have unique names. It's just that you should not write code if (!strcmp(typeid(a).name(),"byte")) ... and assume that you know the text value of typeid(a).name(). There is also a difference in sizeof(long double) and size of a Polymorph member pointer. No problems there either. gcc and VS 2003 doesn't use the same memory layouts, name mangling etc so they are not expected to be identical. /Per W On Tue, 21 Dec 2004, Justin Fan wrote: > Hi, all > I just read a article from CSDN, > http://community.csdn.net/Expert/topic/3662/3662092.xml?temp=.1579553 > since its language is Chinese, so I just copy the source file here and > list the result. > Please compare the result generated by Dev-C++ from VS 2003. How do > you think about it? > > Source Code: > #include <iostream> > #include <typeinfo> > > template<typename T> > class Type > { > public: > static void print() > { > std::cout << "This Type is " << typeid(T).name() > << ", It's size = " << sizeof(T) << "." > << std::endl; > } > }; > > struct Polymorph > { > virtual ~Polymorph() {} > }; > > enum Bit { sero, one }; > enum Intensity { black = 0, brightest = 1000 }; > > int main() > { > Type<bool>::print(); > Type<char>::print(); > Type<signed char>::print(); > Type<unsigned char>::print(); > Type<wchar_t>::print(); > Type<short int>::print(); > Type<signed short int>::print(); > Type<unsigned short int>::print(); > Type<int>::print(); > Type<signed int>::print(); > Type<unsigned int>::print(); > Type<long int>::print(); > Type<signed long int>::print(); > Type<unsigned long int>::print(); > Type<long long int>::print(); > Type<signed long long int>::print(); > Type<unsigned long long int>::print(); > > Type<float>::print(); > Type<double>::print(); > Type<long double>::print(); > > Type<int *>::print(); > Type<int (*)()>::print(); > Type<void (Polymorph::*)()>::print(); > Type<void*>::print(); > > Type<Bit>::print(); > Type<Intensity>::print(); > > return 0; > } > > The result from Dev-C++: > > This Type is b, It's size = 1. > This Type is c, It's size = 1. > This Type is a, It's size = 1. > This Type is h, It's size = 1. > This Type is w, It's size = 2. > This Type is s, It's size = 2. > This Type is s, It's size = 2. > This Type is t, It's size = 2. > This Type is i, It's size = 4. > This Type is i, It's size = 4. > This Type is j, It's size = 4. > This Type is l, It's size = 4. > This Type is l, It's size = 4. > This Type is m, It's size = 4. > This Type is x, It's size = 8. > This Type is x, It's size = 8. > This Type is y, It's size = 8. > This Type is f, It's size = 4. > This Type is d, It's size = 8. > This Type is e, It's size = 12. > This Type is Pi, It's size = 4. > This Type is PFivE, It's size = 4. > This Type is M9PolymorphFvvE, It's size = 8. > This Type is Pv, It's size = 4. > This Type is 3Bit, It's size = 4. > This Type is 9Intensity, It's size = 4. > > The result from VS2003: > > This Type is bool, It's size = 1. > This Type is char, It's size = 1. > This Type is signed char, It's size = 1. > This Type is unsigned char, It's size = 1. > This Type is unsigned short, It's size = 2. > This Type is short, It's size = 2. > This Type is short, It's size = 2. > This Type is unsigned short, It's size = 2. > This Type is int, It's size = 4. > This Type is int, It's size = 4. > This Type is unsigned int, It's size = 4. > This Type is long, It's size = 4. > This Type is long, It's size = 4. > This Type is unsigned long, It's size = 4. > This Type is __int64, It's size = 8. > This Type is __int64, It's size = 8. > This Type is unsigned __int64, It's size = 8. > This Type is float, It's size = 4. > This Type is double, It's size = 8. > This Type is long double, It's size = 8. > This Type is int *, It's size = 4. > This Type is int (__cdecl*)(void), It's size = 4. > This Type is void (__thiscall Polymorph::*)(void), It's size = 4. > This Type is void *, It's size = 4. > This Type is enum Bit, It's size = 4. > This Type is enum Intensity, It's size = 4. > > > -- > Thanks > Z.J. > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |