-
pointer arrays
I'm not sure if I'm understanding this properly, i have the following in c++
Code:
void test1(byte* dcData,int x,int y)
{
int startrow=0;
int endrow=2;
byte* data = dcData;
byte* adjusteddata=data+startrow*x+startcol*y;
for(int y=0;y<whatever;y++)
{
byte* dest=adjusteddata+x*y;
}
}
I've done a conversion to c# but i think I may be interpreting it wrong??
Code:
public void test1(byte[] dcData,int x,int y)
{
int startrow=0;
int endrow=2;
byte[] data = dcData;
byte[] adjusteddata=data+startrow*x+startcol*y;
for(int y=0;y<whatever;y++)
{
byte[] dest=adjusteddata+x*y;
}
}
-
Seems like more of a C# forum question.
-
If you are changing it to c# method, then you will need to declare as unsafe, which basically means you code maybe executed depending upon the users machine you are running it on. If you start using c style types, then your code becomes less portable; which works against the .net framework. Its still a pile of toss anyway (well its ok i suppose), c++ will always live!
-
I suppose if you describe what you want to do, I could show you a way to implement it properly in C#. However, the piece you have given doesn't do anything usefull and I won't take guesses what it should do.
Give a clear description what you want the function to do and what parameters you want to give and we'll find a nice implementation.
-
I think PaulStat just wants to know if the second piece of code does the same thing in C# that the first code does in C++. I don't think he wants an optimization or anything.
Shouldn't this sort of thing be in a documentation somewhere, or a tutorial?