## Miscellaneous

Strings
Use of const

### Strings

wxString has replaced char* in the majority of cases. For passing strings into functions, this should not normally require you to change your code if the syntax is otherwise the same. This is because C++ will automatically convert a char* or const char* to a wxString by virtue of appropriate wxString constructors.

However, when a wxString is returned from a function in wxWindows 2.0 where a char* was returned in wxWindows 1.xx, your application will need to be changed. Usually you can simplify your application's allocation and deallocation of memory for the returned string, and simply assign the result to a wxString object. For example, replace this:

      char* s = wxFunctionThatReturnsString();
      s = copystring(s); // Take a copy in case it is temporary
      .... // Do something with it
      delete[] s;

with this:

      wxString s = wxFunctionThatReturnsString();
      .... // Do something with it

To indicate an empty return value or a problem, a function may return either the empty string ("") or a null string. You can check for a null string with wxString::IsNull().

### Use of const

The const keyword is now used to denote constant functions that do not affect the object, and for function arguments to denote that the object passed cannot be changed.

This should not affect your application except for where you are overriding virtual functions which now have a different signature. If functions are not being called which were previously, check whether there is a parameter mismatch (or function type mismatch) involving consts.

Try to use the const keyword in your own code where possible.