Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++/CLI pin_ptr

Tags:

c#

c++-cli

Is C++/CLI's pin_ptr the equivalent of C#'s fixed statement?

like image 523
Xenoprimate Avatar asked Jul 16 '26 22:07

Xenoprimate


1 Answers

Yes, pretty much.

Some differences:

  1. A fixed statement creates its own scope block. pin_ptr's scope is from its initialization to the end of the enclosing block.
  2. fixed is an explicit language feature. pin_ptr is a use of a general language feature (C++ templates).(See comments.)

There are probably more differences like the above. But, when translating between the two languages, they are generally equivalent.

like image 109
Tom Blodget Avatar answered Jul 19 '26 12:07

Tom Blodget



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!