News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

const wxString

Started by sethjackson, January 24, 2006, 01:04:21 AM

Previous topic - Next topic

sethjackson

Code (cpp) Select

const wxString DESCR = _("Welcome to ") + APP_NAME + _T(" v") + APP_VERSION + _T("!\n") + APP_NAME +
   _(" is a full-featured IDE (Integrated Development Environment) "
     "aiming to make the individual developer (and the development team) "
     "work in a nice programming environment offering everything he/they "
     "would ever need from a program of that kind.\n"
     "Its pluggable architecture allows you, the developer, to add "
     "any kind of functionality to the core program, through the use of "
     "plugins...\n");


I know for a fact that it crashes on APP_NAME..... C::B fails to load with the above code why????

rickg22

I think APP_NAME stopped being a macro and began being a variable.

takeshimiya

Yes, someone who changed APP_NAME and their friends to be a variable, forgot to update all the code.

Just do a Find in Files search and you'll notice. :)

280Z28

Move it to appglobals.cpp
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
Check out The Sam Zone :cool:

sethjackson

That code above is in dlgabout.cpp no way it can go to appglobals.cpp. I want to know why the above code crashes and other code that uses APP_NAME doesn't.....

takeshimiya

APP_NAME.c_str() ...................

sethjackson

Quote from: Takeshi Miya on January 24, 2006, 03:30:03 AM
APP_NAME.c_str() ...................

Hmmm...

Code (cpp) Select

const wxString DESCR = _("Welcome to ") + APP_NAME.c_str() + _T(" v") + APP_VERSION.c_str() +
                       _T("!\n") + APP_NAME.c_str() +
   _(" is a full-featured IDE (Integrated Development Environment) "
     "aiming to make the individual developer (and the development team) "
     "work in a nice programming environment offering everything he/they "
     "would ever need from a program of that kind.\n"
     "Its pluggable architecture allows you, the developer, to add "
     "any kind of functionality to the core program, through the use of "
     "plugins...\n");



src\dlgabout.cpp:32: error: invalid operands of types `const wxChar*' and `const wxChar*' to binary `operator+'

takeshimiya

Heh, that's true, trying to add pointers to char...  :P

wxString(APP_NAME) would do the trick then :D

sethjackson

Quote from: Takeshi Miya on January 24, 2006, 03:46:34 AM
Heh, that's true, trying to add pointers to char...  :P

wxString(APP_NAME) would do the trick then :D

Alreadey did that. It crashes too.  :P

This doesn't crash

wxString(APP_NAME.c_str()) but I get no text....  :lol:

What is going on???  :?

280Z28

Move it to appglobals.cpp

It's trying to initialize that variable before APP_NAME is set to anything.

I know, I made this change a few days ago...
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
Check out The Sam Zone :cool:

thomas

#10
Sam is right as far as the problem is concerned. It is a problem of order of initialisation.
But his solution is not good, the variable does not belong into app.cpp oops... appglobals.cpp.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

mandrav

Quote from: 280Z28 on January 24, 2006, 05:34:30 AM
Move it to appglobals.cpp

See Sam? That's what I was talking about in our PM conversation the other day...

sethjackson, Sam got it right: it's a global creation order problem.
But for heaven's sake don't move it to appglobals!   :shock:
Just move it inside the function where it is used. IIRC it's only used in the constructor.
Be patient!
This bug will be fixed soon...

280Z28

I renamed it to APP_DESC when I moved it. It seemed reasonable to say that's the description of Code::Blocks, and I put an extern blah blah in appglobals.h.

I'd say it's as relevant in the global scope as APP_NAME is, plus you don't have to worry about going to find it in some dialog code when it's more relevant to the app than it is to that specific dialog. I stand that it should go in appglobals.h/cpp :)
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
Check out The Sam Zone :cool:

sethjackson

Quote from: mandrav on January 24, 2006, 08:39:40 AM
Quote from: 280Z28 on January 24, 2006, 05:34:30 AM
Move it to appglobals.cpp

See Sam? That's what I was talking about in our PM conversation the other day...

sethjackson, Sam got it right: it's a global creation order problem.
But for heaven's sake don't move it to appglobals!   :shock:
Just move it inside the function where it is used. IIRC it's only used in the constructor.

Yeah I won't. I got a PM from thomas about this (sort of)..... I will start coding after lunch.  :D