C++ Advantages Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
computerquip
Experienced Solver
Experienced Solver
Posts: 72
Joined: Fri Feb 20, 2009 7:13 pm
Location: $(#wx)\src

C++ Advantages

Post by computerquip »

Why doesn't wxWidgets use the wx namespace? Or give the ability to use C++ exceptions?
Mojo
Super wx Problem Solver
Super wx Problem Solver
Posts: 401
Joined: Wed Sep 21, 2005 8:17 am
Location: Rostov-on-Don, Southern Russia

Re: C++ Advantages

Post 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...
Win XP HE SP3, Vista
Xubuntu 12.04 LTS
wxWidgets-2.9.5
wxWidgets-3.0.0
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post 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
"Keyboard not detected. Press F1 to continue"
-- Windows
computerquip
Experienced Solver
Experienced Solver
Posts: 72
Joined: Fri Feb 20, 2009 7:13 pm
Location: $(#wx)\src

Post by computerquip »

If someone were to go in and change everything to the wx namespace and submit a patch, would it be accepted?
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post 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 ;)
"Keyboard not detected. Press F1 to continue"
-- Windows
Mojo
Super wx Problem Solver
Super wx Problem Solver
Posts: 401
Joined: Wed Sep 21, 2005 8:17 am
Location: Rostov-on-Don, Southern Russia

Post 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?
Win XP HE SP3, Vista
Xubuntu 12.04 LTS
wxWidgets-2.9.5
wxWidgets-3.0.0
computerquip
Experienced Solver
Experienced Solver
Posts: 72
Joined: Fri Feb 20, 2009 7:13 pm
Location: $(#wx)\src

Post 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.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Post 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.
Last edited by stahta01 on Sat Jul 10, 2010 11:38 pm, edited 1 time in total.
Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post 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.
What is little and green, witch go up and down ??
Yoda playing with the force.
Post Reply