Home » U++ Library support » U++ Core » :( errors on sfx project
Re: :( errors on sfx project [message #30492 is a reply to message #30478] |
Wed, 05 January 2011 08:29 |
mr_ped
Messages: 825 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
int mai(const char *GetExeTitle) {
Don't do this please, GetExeTitle is very ugly parameter name, easy to confuse with upp function.
I would use "filename", also the description of function is sort of wrong, because it does *not* extract data from "this executable", it does extract data from any executable you give the name as parameter. So I would rephrase the comment.
Also the name of the function should reflect that, use something like "int ExtractZpaqDataFromExeFile( const char *filename ) {"
It's no code change to source, but during searching for the error you have your source did confuse me a lot and was difficult to read. That's bad practice.
Now to the error:
void Click()
{
mai(GetExeTitle.c_str);
//missing (), so you don't call the function
// Try:
mai(GetExeTitle());
// the (const char *) conversion will very likely work
// automagically, if not, use casting
}
edit: also maybe you should go over some more C++ tutorials to get more used to C++ syntax, because not calling function is quite a basic bug. Fortunately for you this one is not compilable, but in some rare situations you may end using function pointer value without executing function, instead of return value, which may go trough compilation silently, and you will find out only after app crash. C++ has plenty of ways how to write bogus code which compiles without warning, so making sure the basic syntax sinks into your blood and you write 99% time what you THINK is important for good productivity.
[Updated on: Wed, 05 January 2011 08:35] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri May 10 19:03:18 CEST 2024
Total time taken to generate the page: 0.02980 seconds
|