I've come across some code syntax I've never seen. It compiled, but I don't know how, or what it even does!
I've been reading a book about DirectX, and in one of the examples, this little piece of code was present:
D3DXMATRIX *D3DXMatrixIdentity(D3DXMATRIX *pout);
"D3DXMATRIX" is a type, of course. And "D3DXMatrixIdentity" is a function, of course. Now I don't see how this works.
Okay, to break it down, first we have a type, which is D3DXMATRIX, then we have the indirection-operator (which I assume is a pointer), and then we have a function (perhaps a call) with a new D3DXMATRIX (pointer) as it's only parameter.
How the heck does this work It isn't just a regular function-call. It isn't a function-call that'll return anything to something, so whaaaa
To further illustrate my confusion, I'll give another example:
class
someClass{
};
someClass someFunction(someClass xx)
{
return xx;}
int
main(){
someClass blah;
someClass *someFunction(&blah);
That code makes no sense at all to me. And if you change the return-type, or if you pass in a variable by value, rather than by it's address, I get a compile error.
And if anyone can explain how this works, can you please tell me what it actually does
I'm sure I can figure this out myself, and there's bound to be some documtation on this somewhere, but it's kinda hard to describe this problem :P
Like I said, I'm sure I can figure it out, but asking to see someone knows is good too.
Thanks :)