Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Bug in Core06.cpp or in U++ Core value types tutorial
Re: Bug in Core06.cpp or in U++ Core value types tutorial [message #13018 is a reply to message #13017] Wed, 05 December 2007 14:59 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14255
Registered: November 2005
Ultimate Member
[quote title=Werner wrote on Wed, 05 December 2007 08:29]
luzr wrote on Wed, 05 December 2007 12:07

This is a complete output from quick test:

I'm running upp-mingw-711-dev2.

I got my results building the original core06.cpp example using gcc 4.2.1 under Windows XP.

Werner



Thank you. Bug reproduced and fixed (templates are implemented according to standard in GCC... while MSC interpreted certain code as I wanted.... Smile.

To be sure, please replace these in Value.h:

template <class T>
inline dword ValueTypeNo(const T&)       { return StaticTypeNo<T>() + 0x8000000;; }

template<> inline dword ValueTypeNo(const int&)     { return INT_V; }
template<> inline dword ValueTypeNo(const int64&)   { return INT64_V; }
template<> inline dword ValueTypeNo(const double&)  { return DOUBLE_V; }
template<> inline dword ValueTypeNo(const bool&)    { return BOOL_V; }
template<> inline dword ValueTypeNo(const String&)  { return STRING_V; }
template<> inline dword ValueTypeNo(const WString&) { return WSTRING_V; }
template<> inline dword ValueTypeNo(const Date&)    { return DATE_V; }
template<> inline dword ValueTypeNo(const Time&)    { return TIME_V; }

template <class T, dword type, class B = EmptyClass>
class AssignValueTypeNo : public B {
public:
	friend dword ValueTypeNo(const T&)                  { return type; }

	void operator=(const AssignValueTypeNo&) {} // MSC 6.0 empty base class bug fix
};

template <class T>
bool IsType(const Value& x, T* = 0)           { return ValueTypeNo(*(T *)NULL) == x.GetType(); }

template <class T>
inline bool Value::Is() const
{
	return IsType<T>(*this);
}


..and test..

Mirek

[Updated on: Wed, 05 December 2007 15:00]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Question / Issue about Vector
Next Topic: <<= and <<
Goto Forum:
  


Current Time: Mon Apr 28 06:18:34 CEST 2025

Total time taken to generate the page: 0.00567 seconds