Does .NET Micro Framework support unsafe code? In other words, can I use pointers in my code for .NET Micro Framework?
.NET Micro Framework Unsafe code
Asked Answered
From the Wikipedia page (emphasis mine):
For example, the platform does not support symmetric multiprocessing, multi-dimensional arrays, machine-dependent types, or unsafe instructions.
The technical white paper lists it in the omitted features too.
@MarcGravell: Thanks, changed it to a scribd one. –
Zinn
Although this is an ancient question (in SO time), I have added an answer which shows that the
unsafe
keyword apparently works at present, although it remains a documented "unsupported" feature. –
Absorptivity @nicholas: I suspect it was introduced in a later version. –
Zinn
possibly. i can find no documentation stating that it is a supported feature (or unsupported for that matter). hard to say when it was added –
Absorptivity
While it works it's rather unreliable, even in 4.3 For example [var result = *(((short*)numRef));] will retrieve 2 bytes on the desktop but only one on the micro framework. We found that out the hard way ... –
Kenway
Although officially not supported, I have personally used and tested unsafe code in NETMF 4.2 and find that it works as expected.
Another developer provides sample code for implementing a BitConverter
class on NETMF doing just this:
http://forums.netduino.com/index.php?/topic/308-bitconverter/
© 2022 - 2024 — McMap. All rights reserved.