Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

wx2.9 compatibility

(1/4) > >>

Loaden:
Unnecessary:

--- Code: ---#if wxCHECK_VERSION(2, 9, 0)
Manager::Get()->GetLogManager()->DebugLog(F(_T("workspace config: '%s'"), s.wx_str()));
#else
Manager::Get()->GetLogManager()->DebugLog(F(_T("workspace config: '%s'"), s.c_str()));
#endif

--- End code ---
Only:

--- Code: ---Manager::Get()->GetLogManager()->DebugLog(F(_T("workspace config: '%s'"), s.wx_str()));

--- End code ---

Unnecessary:

--- Code: ---#if wxCHECK_VERSION(2, 9, 0)
switch (str[pos].GetValue())
#else
switch (str[pos])
#endif
--- End code ---
Only:

--- Code: ---switch ((wxChar)str[pos])
--- End code ---
Or:

--- Code: ---switch ((wxChar)str.GetChar(pos))
--- End code ---

Unnecessary:

--- Code: ---#if wxCHECK_VERSION(2, 9, 0)
str.Append(m_Buffer[startIndex], writeLen);
#else
str.Append(&m_Buffer[startIndex], writeLen);
#endif
--- End code ---
Only:

--- Code: ---str.Append((const wxChar*)m_Buffer + startIndex, writeLen);
--- End code ---



Unnecessary:

--- Code: ---#if wxCHECK_VERSION(2, 9, 0)
txtParent->SetLabel(wxString::Format(_T("%s (%d)"), _("<Global namespace>").wx_str(), m_Token->m_ParentIndex));
#else
txtParent->SetLabel(wxString::Format(_T("%s (%d)"), _("<Global namespace>"), m_Token->m_ParentIndex));
#endif

--- End code ---
Only:

--- Code: ---txtParent->SetLabel(wxString::Format(_T("%s (%d)"), (const wxChar*)_("<Global namespace>"), m_Token->m_ParentIndex));

--- End code ---

...

Any comments?

killerbot:
just a personal taste, I am not so fond of all the casting ( in general).
But ifdefs are also not that nice.

Problem with the casts could be that some developers sees it, thinks it is not necessary and removes them again. And I guess only in 50% they will ne needed : 2.9.0 compared to earlier ...

Biplab:
It's not a matter of personal choice. Rather it's to provide a guaranteed compatibility upto wx 2.8.0. For example the following code may not work with wx-2.8.0 as wxString::wx_str() function was not available. At least it is missing in doc. IIRC it was added in the midst of wx 2.8 series.


--- Code: ---Manager::Get()->GetLogManager()->DebugLog(F(_T("workspace config: '%s'"), s.wx_str()));
--- End code ---

As long as the modified code works both with wx-2.8.x and wx-2.9.x I'm ok with such change.

stahta01:

--- Quote from: Biplab on December 10, 2010, 08:11:01 am ---It's not a matter of personal choice. Rather it's to provide a guaranteed compatibility upto wx 2.8.0. For example the following code may not work with wx-2.8.0 as wxString::wx_str() function was not available. At least it is missing in doc. IIRC it was added in the midst of wx 2.8 series.


--- Code: ---Manager::Get()->GetLogManager()->DebugLog(F(_T("workspace config: '%s'"), s.wx_str()));
--- End code ---

As long as the modified code works both with wx-2.8.x and wx-2.9.x I'm ok with such change.

--- End quote ---

It existed in 2.6 and 2.8 wxWidgets and likely 2.0. It was used in the past and was replaced with c_str() at some time. I think it was replaced by c_str() with the start of 2.0 wxWidgets.

Tim S.

Biplab:

--- Quote from: stahta01 on December 10, 2010, 10:33:26 pm ---
--- Quote from: Biplab on December 10, 2010, 08:11:01 am ---It's not a matter of personal choice. Rather it's to provide a guaranteed compatibility upto wx 2.8.0. For example the following code may not work with wx-2.8.0 as wxString::wx_str() function was not available. At least it is missing in doc. IIRC it was added in the midst of wx 2.8 series.


--- Code: ---Manager::Get()->GetLogManager()->DebugLog(F(_T("workspace config: '%s'"), s.wx_str()));
--- End code ---

As long as the modified code works both with wx-2.8.x and wx-2.9.x I'm ok with such change.

--- End quote ---

It existed in 2.6 and 2.8 wxWidgets and likely 2.0. It was used in the past and was replaced with c_str() at some time. I think it was replaced by c_str() with the start of 2.0 wxWidgets.

Tim S.

--- End quote ---

It is possible that it may have existed before wx-2.8.0. However in wx-2.8.0 doc it was undocumented. What I did was to ensure that our existing code is unaffected by the changes that I'm making for wx-2.9 migration.

Frankly speaking unless it is absoultely necessary I don't want to use any undocumented functions. Also a few #ifdef statements won't affect the final binary adversely even though it adds few lines to the source file. But it does what it is supposed to do; that is to not to break existing code.

Navigation

[0] Message Index

[#] Next page

Go to full version