Page 1 of 1

C++ Advantages

Posted: Wed Mar 31, 2010 5:01 pm
by computerquip
Why doesn't wxWidgets use the wx namespace? Or give the ability to use C++ exceptions?

Re: C++ Advantages

Posted: Wed Mar 31, 2010 5:18 pm
by Mojo
computerquip wrote:Why doesn't wxWidgets use the wx namespace? Or give the ability to use C++ exceptions?
I suppose cause all wxWidgets classes already have prefix "wx" before them names...

Posted: Wed Mar 31, 2010 6:11 pm
by Auria
This was discussed to death

The main reason is that wx started before namespaces existed. And now there's no point re-doing everything for such little gain

Posted: Thu Apr 01, 2010 4:34 pm
by computerquip
If someone were to go in and change everything to the wx namespace and submit a patch, would it be accepted?

Posted: Thu Apr 01, 2010 5:54 pm
by Auria
computerquip wrote:If someone were to go in and change everything to the wx namespace and submit a patch, would it be accepted?
this is a question for the mailing list ;)

Posted: Fri Apr 02, 2010 7:29 am
by Mojo
computerquip wrote:If someone were to go in and change everything to the wx namespace and submit a patch, would it be accepted?
What for? To make wxWidgets more complicated?

Posted: Sat Apr 03, 2010 6:44 am
by computerquip
No! Why would I suggest something that did nothing but complicate. Namespaces aren't terribly complicated in concept anyways, plus they give a few minor advantages. One mainly being a distinct scope which gives the user a little bit more flexibility. For instance, he could use

Code: Select all

wx::Frame bob;
or

Code: Select all

using wx::Frame; Frame bob;
Although, please remember this isn't the only subject that I brought up. Another topic was C++ exceptions. There are also a few advantageous abilities that exceptions provide, one mainly being clean-like error handling, and shortened, organized code. Just a few suggestions and asking about the obvious, not making a revolution here or anything...

On a side note: Exceptions take a toll in C++ whether you use them or not. There's really no definite reason why not to use them other than preference.

Another side note: These are simply small things that add miniscule differences. I can picture why small things like namespaces can be a huge leap though since any new versions of wxWidgets would have to be remade to relate to the new major change.

Posted: Thu Jun 17, 2010 5:41 pm
by stahta01
The main problem in 2.8 was that many of the support compilers did not support name-spaces and C++ exceptions. The wx Team dropped a few old compilers/versions. If all the supported compilers can do name spaces the wx team might support/use the patch to do name spaces; the patch would require a lot of work for very little short term gain, the long term might be a major gain.

Note: The patch would be needed against widgets trunk and would likely take a lot of effort to keep updating because it could be a few years before if might be applied to the trunk.

I would see if the wx develop team would want the patch before doing much work.
http://www.wxwidgets.org/support/maillst2.htm

wxWidget links; I an mainly a C programmer; so, I am not certain these links are useful.
http://wiki.wxwidgets.org/Namespaces

Tim S.

Posted: Fri Jun 18, 2010 6:01 am
by Cursor
AFAK, some wxWidgets macros (DECLARE/IMPLEMENT_DYNAMIC_CLASS or BEGIN_EVENT_TABLE ...) can not accepts "::" in class names, so introduce wx namespace can be difficult.