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

Question about wx_str() and c_str()

(1/2) > >>

ollydbg:
There are many code in the current trunk like below:


--- Code: ---            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Looking for type: '%s' (%d components)"), actual.wx_str(), type_components.size()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Looking for type: '%s' (%d components)"), actual.c_str(), type_components.size()));
            #endif

--- End code ---

After checking the wxWidgets header file(Windows)
D:\wxWidgets-2.8.10\include\wx\string.h

I find this statement:


--- Code: ---    const wxChar* wx_str()  const { return c_str(); }

--- End code ---

So, I just manually change above code to below( remove the preprocessor  guard)

--- Code: ---                Manager::Get()->GetLogManager()->DebugLog(F(_T("Looking for type: '%s' (%d components)"), actual.wx_str(), type_components.size()));

--- End code ---

It builds and works with no problem.

So, my question is: why not clean up these codes?
Thanks.



MortenMacFly:

--- Quote from: ollydbg on October 08, 2009, 02:50:05 am ---
--- Code: ---    const wxChar* wx_str()  const { return c_str(); }

--- End code ---

--- End quote ---
This was added late to wxWidgets v2.8.10. If you remove the other option it'll break compilation of C::B on platforms where not the "latest" a.k.a v2.8.10 version of wxWidgets is available.

However, the cleanup will be done sooner or later...

ollydbg:

--- Quote from: MortenMacFly on October 08, 2009, 07:09:38 am ---
--- Quote from: ollydbg on October 08, 2009, 02:50:05 am ---
--- Code: ---    const wxChar* wx_str()  const { return c_str(); }

--- End code ---

--- End quote ---
This was added late to wxWidgets v2.8.10. If you remove the other option it'll break compilation of C::B on platforms where not the "latest" a.k.a v2.8.10 version of wxWidgets is available.

However, the cleanup will be done sooner or later...

--- End quote ---

I see, thanks!!

stahta01:

--- Quote from: MortenMacFly on October 08, 2009, 07:09:38 am ---
--- Quote from: ollydbg on October 08, 2009, 02:50:05 am ---
--- Code: ---    const wxChar* wx_str()  const { return c_str(); }

--- End code ---

--- End quote ---
This was added late to wxWidgets v2.8.10. If you remove the other option it'll break compilation of C::B on platforms where not the "latest" a.k.a v2.8.10 version of wxWidgets is available.

However, the cleanup will be done sooner or later...

--- End quote ---

I added the unneeded guard per an C::B dev request to get the patches applied.

The wx_str() has been in wxWidgets for years; but, it was obsoleted years ago.
Therefore, the was no wxWidgets docs saying it was safe to use.

From wxWidgets 2.8.0

--- Code: ---    // identical to c_str(), for wxWin 1.6x compatibility
    const wxChar* wx_str()  const { return c_str(); }

--- End code ---

Tim S.


 

ollydbg:

--- Quote from: stahta01 on October 08, 2009, 02:12:55 pm ---I added the unneeded guard per an C::B dev request to get the patches applied.

--- End quote ---
:D
Sorry, I can't understand, what does this sentence mean?

Navigation

[0] Message Index

[#] Next page

Go to full version