Menu

What pointer arithmetic looks like decompiled
📰

What pointer arithmetic looks like decompiled

DEV Community: csharp·Zero Heartbeat·about 9 hours ago
#trbMhkIi
#devtocsharp#devto#dev#pointer#ldind
Long article (1708 words) — no AI summary yet.
Reading 0:00
15s threshold

Pointer code in C# is dense with syntax: the * dereference, the & address-of, the [i] indexer, the -> arrow. None of it survives to IL. A method full of unsafe pointer work compiles to a flat stream of integer arithmetic and ldind / stind opcodes, with the pointer-ness living only in the signature types and the width of each load. Point a decompiler at it and the interesting question is how much of that syntax comes back — and how much it has to infer , because the IL does not record it. This post walks the IL for a few tiny unsafe methods and shows what Glass.NET reconstructs, and where the reconstruction has to guess.

The focus here is raw pointer arithmetic in code that is already unsafe and, where needed, already pinned.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.