Global flag for unsafe?
                    Currently I need to write unsafe Main function code in just "C# Program" mode. Wondering is it possible to introduce a "global unsafe mode", so that I don't need to switch to "C# Program" to make the code working? (So I can delete ~3 lines of code and lots of tab  )
 )
                             )
 )
With "global unsafe mode ON", I can get rid of the Main function and the tabs.
unsafe void Main()
{
AVCodec* codec = avcodec_find_encoder_by_name("libx264");
AVCodecContext* c = CreateCodecContext(codec);
AVPacket* pkt = av_packet_alloc();
V(avcodec_open2(c, codec, null));
AVFrame* frame = av_frame_alloc();
frame->format = (int)c->pix_fmt;
frame->width = c->width;
frame->height = c->height;
V(av_frame_get_buffer(frame, 32));
using (FileStream file = File.Create(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @test.h264)))
{
WriteFrames(frame, c, pkt, file);
}
avcodec_free_context(&c);
av_frame_free(&frame);
av_packet_free(&pkt);
}
AVCodec* codec = avcodec_find_encoder_by_name("libx264");
AVCodecContext* c = CreateCodecContext(codec);
AVPacket* pkt = av_packet_alloc();
V(avcodec_open2(c, codec, null));
AVFrame* frame = av_frame_alloc();
frame->format = (int)c->pix_fmt;
frame->width = c->width;
frame->height = c->height;
V(av_frame_get_buffer(frame, 32));
using (FileStream file = File.Create(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @test.h264)))
{
WriteFrames(frame, c, pkt, file);
}
avcodec_free_context(&c);
av_frame_free(&frame);
av_packet_free(&pkt);
Comments
- 
            I'm not sure that we need an option - can you think of any reason why unsafe shouldn't just be the default?
- 
            @JoeAlbahari Sure, cool, if you gonna do that(unsafe by default), I'll love it, so I can just write code like this:
 instead of do that:
 int v = 3;
 int* p = &v;
 unsafe void Main()
 {
 int v = 3;
 int* p = &v;
 }
- 
            OK - this will be in the next build  

