❔ unsafe pointer operation

hi. im trying to rewrite code from other c# project to restore the sanity back. there is this one part that i dont quite understand:
byte[] arr = ...;
byte* buffer = arr;
var x = *buffer++; // actual line is much more complicated operations than this
byte[] arr = ...;
byte* buffer = arr;
var x = *buffer++; // actual line is much more complicated operations than this
what does the *buffer++ do? is it equal to buffer[index++] or buffer[index]++. thanks.
7 Replies
cap5lut
cap5lut2y ago
$tias
realivanjxツ
realivanjxツOP2y ago
thanks a lot
Tvde1
Tvde12y ago
it looks like this gets an element in the array every time you increase the pointer, it points to the next element
Nox
Nox2y ago
This is not an acceptable response. Please refrain from meaningless contributions.
Chiyoko_S
Chiyoko_S2y ago
it's equivalent to buffer[index++] yes it's just that you don't keep the original base pointer
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server