Top "Unsafe" questions

In C# or Rust, the unsafe keyword marks code able to work directly with memory pointers, bypassing some of the language's safety checks.

How can I use pointers in Java?

I know Java doesn't have pointers, but I heard that Java programs can be created with pointers and that this …

java pointers unsafe
Why do I get the error "Unsafe code may only appear if compiling with /unsafe"?

Why do I get the following error? Unsafe code may only appear if compiling with /unsafe"? I work in C# …

c# visual-studio-2008 windows-ce unsafe
Error lnk2026: module unsafe for safeseh image

I got this error when building a sample visual C++ project. First I downloaded 3 sample projects, all solve the same …

visual-c++ unsafe
Why does sun.misc.Unsafe exist, and how can it be used in the real world?

I came across the sun.misc.Unsafe package the other day and was amazed at what it could do. Of …

java unsafe
Maximum length of byte[]?

I'm trying to create an array of bytes whose length is UInt32.MaxValue. This array is essentially a small(ish) …

c# arrays byte unsafe
Is there a way to get a reference address?

In Java, is there a way to get reference address, say String s = "hello" can I get the address of …

java memory jvm unsafe
Where is sun.misc.Unsafe documented?

Does anyone know of any comprehensive documentation for sun.misc.Unsafe? I'm looking for documentation on Unsafe.putOrderedInt(). This was …

unsafe java
C# performance - Using unsafe pointers instead of IntPtr and Marshal

Question I'm porting a C application into C#. The C app calls lots of functions from a 3rd-party DLL, so …

c# c pinvoke marshalling unsafe
Cannot take the address of, get the size of, or declare a pointer to a managed type

I've done a fair bit of research, but am stuck now as to why I'm still getting this error. I …

c# pointers unsafe
True Unsafe Code Performance

I understand unsafe code is more appropriate to access things like the Windows API and do unsafe type castings than …

c# performance unsafe