That’s not possible, is it? But there is.
What the difference is here is not clear to me. I can’t imagine that C# and C++ have different priorities for basic operations. I had intended to migrate most of my old code from C++ to C# (unsafe), but now I find myself confused.
Code:
C++ Version
static void func() {
uint8 ms[4] = { 44, 55, 66, 77 };
uint8 md[4] = { 0, 1, 2, 3 };
uint8* d = md;
*d++ = ms[*d];
*d++ = ms[*d];
*d++ = ms[*d];
*d++ = ms[*d];
}
Result in MD:
md: 44,55,66,77
C# Version
static void func() {
var ms = new byte[] { 44, 55, 66, 77 };
var md = new byte[] { 0, 1, 2, 3 };
fixed (byte* ud = md) {
byte* d = ud;
*d++ = ms[*d];
*d++ = ms[*d];
*d++ = ms[*d];
*d++ = ms[*d];
}
}
Result in MD
md: 55,66,77,44
New contributor
Alex Xelo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.