|
-
January 30th, 2013, 06:41 AM
#7
Re: Convert this line from C++ to C#
 Originally Posted by Paul McKenzie
All that function calls for is a pointer, and that is exactly what is being passed -- a pointer.
So you aren't aware of what the address-of operator is supposed to do?
If you do not know a basic concept such as passing the address of a variable, then write very simple code to familiarize yourself with such concepts:
Code:
void func(int *p)
{
*p = 10;
}
int main()
{
int x = 0;
func(&x);
}
What does this code do? Now compare the code you have now with this simple code.
Regards,
Paul McKenzie
Thank you, using "address-of" keyword I was finally able to find what is was about. I'm confused not really about address, but about that part: tris[first_tri]
In C#, that would mean, that I'm passing not whole Tris[] array, but just some element under number first_tri.
But in C++ function, I see that it uses Tris[] as whole array inside functions, then why bother passing tris[some_value] at all, and not just *tris? Though, now I'll go read in-depth abour address of operator more, maybe that will give some clue.
I just debugged, that most likely &tris[first_tri] indeed cuts half of the array away and start irritating from the middle. Seems like that was made for speed gain, oh dat C++
Last edited by RyuMaster; January 30th, 2013 at 07:27 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|