"C++ is static (language)..."
-
THIS IS NOT A "HOW DO I CODE ..." QUESTION - so if you have an issue with it - DO NOT READ IT.... I have just upset another forum trying to find out why "
int QProcess::execute(const QString &program, const QStringList &arguments = {})
Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.
...will NOT
writes to the console is forwarded to the calling process
when used as STATIC. The above documentation is written specifically for "static" function. I am NOT going to argue about the doc, I just wanted to know what is so special when "static" (function) is used in C++. If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ? Any reply TO THE SUBJECT will be appreciated , even RTFM Cheers Dynamic C++, Part 1[^]
-
THIS IS NOT A "HOW DO I CODE ..." QUESTION - so if you have an issue with it - DO NOT READ IT.... I have just upset another forum trying to find out why "
int QProcess::execute(const QString &program, const QStringList &arguments = {})
Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.
...will NOT
writes to the console is forwarded to the calling process
when used as STATIC. The above documentation is written specifically for "static" function. I am NOT going to argue about the doc, I just wanted to know what is so special when "static" (function) is used in C++. If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ? Any reply TO THE SUBJECT will be appreciated , even RTFM Cheers Dynamic C++, Part 1[^]
The fact that C/C++ is a staticly-typed language has nothing to do with static member functions. In turn these have very little to do with static functions in general. They are just 3 different uses for the same word.
Member 14968771 wrote:
If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ?
Regular member functions have one extra hidden parameter, the "this" pointer, that points to the object on which they are called. Static member functions don't have this hidden parameter and are very much like any regular function except for some scoping rules. "Static", like "object" and "module" are a very abused words in programming.
Mircea
-
THIS IS NOT A "HOW DO I CODE ..." QUESTION - so if you have an issue with it - DO NOT READ IT.... I have just upset another forum trying to find out why "
int QProcess::execute(const QString &program, const QStringList &arguments = {})
Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.
...will NOT
writes to the console is forwarded to the calling process
when used as STATIC. The above documentation is written specifically for "static" function. I am NOT going to argue about the doc, I just wanted to know what is so special when "static" (function) is used in C++. If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ? Any reply TO THE SUBJECT will be appreciated , even RTFM Cheers Dynamic C++, Part 1[^]
Member 14968771 wrote:
If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ?
A non-static member function is always called via an object reference. That is any call of the form:
obj.SomeMethod(); // where obj is an instance of some class
has access to all the properties of that particular instance. But for a static method called thus:
ClassName::StaticMethod();
has no such access, and can only access static members of the class. But I am not sure that that was your question. Maybe some C++ learning is in order. ps, please do not SHOUT in your messages, it is unnecessary and rude.
-
THIS IS NOT A "HOW DO I CODE ..." QUESTION - so if you have an issue with it - DO NOT READ IT.... I have just upset another forum trying to find out why "
int QProcess::execute(const QString &program, const QStringList &arguments = {})
Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.
...will NOT
writes to the console is forwarded to the calling process
when used as STATIC. The above documentation is written specifically for "static" function. I am NOT going to argue about the doc, I just wanted to know what is so special when "static" (function) is used in C++. If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ? Any reply TO THE SUBJECT will be appreciated , even RTFM Cheers Dynamic C++, Part 1[^]
Member 14968771 wrote:
will not. when used as STATIC.
Presumably you mean... First you tried something without 'static' in place and it worked. Second you put 'static' somewhere and now it doesn't work. The console output does not show up. Not really a lot of information there. So the following are some possibilities for that behavior. - You recompiled, it failed, and then when you ran something it did not find the binary. So it didn't actually run. - You recompiled, it worked (because someone has some 'clever' code) and it failed with an exception. But you did not see that exception output or ignored it. - You recompiled, it worked (because someone has some 'clever' code) and that other code worked. But you did not see any output because the actual method that was called, which is a different one, does not do console output.