Hi all,
what is this part meaning:
Code:... operator _IMQSspServiceBase_FetchedFunction(void) throw(OS390_BASE_EX_BASE); ...
Hi all,
what is this part meaning:
Code:... operator _IMQSspServiceBase_FetchedFunction(void) throw(OS390_BASE_EX_BASE); ...
It's a user-defined conversion operator. It converts a _IMQSsp... to whatever class that function is a member of.
Code:#include <iostream> class Thing { int n; public: Thing(int x) : n(x) { } operator int() { return n; } }; int main() { Thing th(123); // convert int to Thing std::cout << int(th) << '\n'; // convert Thing to int }
I'm kind of terrified of an implicit conversion throwing an error O_o
It allows implicit conversions between unrelated types. Implicit conversion operators can be very dangerous though. If you don't understand why they would be useful, you probably aren't experienced enough to understand when to use them and when not to, and why. Google is a great treasure trove of knowledge on the subject, and I would encourage you to seek out that knowledge. I'd suggest looking up C++ implicit conversion operators, for more info.
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?
But what is _IMQSspServiceBase_FetchedFunction(void)? I didn`t understand the inline function?
Code:inline IMQSspServiceBase::SspFunction:: operator _IMQSspServiceBase_FetchedFunction(void) throw(OS390_BASE_EX_BASE) { TC_TRACE_ENTER(OS390_BASE_TRC_GRP, this, "IMQSspServiceBase::" "SspFunction::operator _IMQSspServiceBase_FetchedFunction"); if (m_fct == 0) { fetch(); } TC_TRACE_LEAVE(OS390_BASE_TRC_GRP); return(m_fct); } #endif // ! _IMQ_SSP_SERVICE_BASE_H_
The inline keyword tells the compiler that the function is a candidate for "inlining." This means that the compiler may insert the actual code of the function anywhere the function is called, as an optimization.
The line:
means that the function may throw exceptions of type OS390_BASE_EX_BASE, and only that type. This style of exception specification is deprecated in newer versions of the C++ standard.Code:throw(OS390_BASE_EX_BASE)
Let's say you have a class called foo. foo implements an implicit conversion operator to int. This would allow the following sort of code to be written:
Code:// assume the definition of class foo as stated int doSomething(int i) { // do something with i } int main() { foo f; doSomething(f); return 0; }
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?