...variable here is a read-only property that cannot be directly assigned to. It can only be assigned to by member functions.
int main(int argc, char* argv[])
{
A a;
cout << a.INITIALIZED << endl; // prints 100
a.reconf(900);
cout << a.INITIALIZED << endl; // prints 900...
Haha..I guess I should just accept the fact that int() is equivalent to int (*)().
Thanks guys!
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
So int() == int (*)()?
I thought the correct declaration for a pointer to a function is int (*)() rather than int().
Can anyone explain why int () is same as int (*)()? I am confused because int () for me looks like an int declaration that is very different from int(*)().
Rome did not create...
...It is in the third item of section 3. Here are the complete examples:
void h(int());
void h(int (*)()); // redeclaration of h(int())
void h(int x()) { } // definition of h(int())
void h(int (*x)()) { } // ill-formed: redefinition of h(int())
Rome...
...What does this mean? Is that argument a pointer to function or what? If it was intended as a pointer to function then should it be declared like this:
void h(int (*)());
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
It would but I am tryinh to undestand thread cancellation which is why I used pthread_cancel and pthread_testcancel.
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
Thanks uolj! Can't I do the one you did for a multimap?
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
Isn't that the predicate for the multimap is for sorting only?
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
There is also the ADAPTIVE Communication Environment (ACE). It provides nice abstractions for your C++ needs.
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
Hi all!
The STL multimap accepts duplicate keys such that the following entry is valid for a multimap:
KEY VALUE
foo bar
jack jill
Now the problem is, multimap also accepts duplicate entries such that if I would add another foo, bar pair the multimap will accept it. So...
You could always check your platform's man pages for this. You just type man gethostbyname. If the man pages are not available you can also google it and typing man gethostbyname also.
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
-...
What platform are you compiling this from?
If you are compiling under Solaris, you would need to add either of the following during linking:
-lxnet -lnsl -lsocket
Hope this helps! [thumbsup]
Rome did not create a great empire by having meetings, they did it by
killing all those who...
I have read in most articles that STL is not thread-safe or should not be used in multi-threading? Why? What are other alternatives or how should one make a thread-safe STL?
Rome did not create a great empire by having meetings, they did it by
killing all those who opposed them.
- janvier -
...{
throw SomeException();
}
}
};
class B
{
public:
...
private:
A the_a;
};
int main(int argc, char* argv[])
{
B the_b; // suppose class A has thrown an exception
// during class B's construction.
}
As you can see from the...
Hi!
Sorry for the late reply.
Here is the snippet.
int ret;
struct hostent *phost;
struct in_addr addr;
char hostname[100];
if(pIPAddrs == NULL)
return -1; /* Need to find suitable return value */
ret = gethostname(hostname, 100);
if(ret == 0)
{
phost =...
Hi!
I am having a bit of a problem getting the local address of my computer. For example, my IP is something like 192.68.1.100. When a do a ifconfig -a, I can see that eth0 is assigned the said IP. So naturally, I tried getting the IP using the socket APIs. However, no matter how hard I try, I...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.