C# - Using "unsafe" compiler (use of pointers)

Hi all,

I’m using C#, and just now trying to use pointers in one of the puzzles.
However, i’m getting the following error while sending my code :
"error CS0227: Unsafe code requires the `unsafe’ command line option to be specified "
Is there anyway to get around that ?
(On Visual Studio, it is simply solved by checking the “enable unsafe code” of the compiler options).

Thanks !

2 Likes

Hi,

We are not sure we should add this option. It seems unclean to provide this functionality in C# as the first intended use of this option is to access native structures/objects of DLLs.

Does anyone else see a reason to add this option in the context of CodinGame? If so could you provide an example of something that you can not do in C# to solve a puzzle on our platform that you could do with this option activated?

I agree that the ability to use pointers in C# does not really help solve puzzles. As far as I’ve seen so far all puzzles can be solved within managed code just fine. If you’d like to use pointers, just use C++ (or Objective C)