What does (*new) do?
I'm trying to troubleshoot an issue my application is having with the activemq-cpp-3.4.0 library, and gotten to the point that I'm tracing lin开发者_如何学运维e by line to see where it's going wrong. The application problem itself is tangential to this question; I came across some code that I don't understand, and I'm hoping someone can explain what's going on.
Tracing down, I find the following code (note: this is technically within the apr library):
alloc_socket(new, cont);
/* For right now, we are not using socket groups. We may later.
* No flags to use when creating a socket, so use 0 for that parameter as well.
*/
(*new)->socketdes = socket(family, type, protocol);
if ((*new)->socketdes == INVALID_SOCKET) {
return apr_get_netos_error();
}
I'm confused enough by the alloc_socket(new, cont)
, but specifically I am interested in what's going on with the (*new) calls. Does this allocate another instance of this
? If so, is it a fallacy to check the stored socketdes
value by using (*new)
again, as that would create another, separate, instance? Or am I just completely off track?
This is C code. In C, new
is an identifier, not a keyword.
精彩评论