Re: Buffer Overflow Errors

From: Tony Morris (not_at_telling.you)
Date: 07/18/04


Date: Sun, 18 Jul 2004 03:19:44 GMT


"Liz" <Liz@nospam.com> wrote in message
news:lVlKc.103959$a24.54770@attbi_s03...
>
> "Tony Morris" <not@telling.you> wrote in message
> news:ey3Kc.4182$K53.3436@news-server.bigpond.net.au...
> >
> > > Close, if I remember right, there is something that you can set
> > > in C# that turns off the run time check for array out of bounds.
> >
> > No there isn't.
> > Perhaps you are confusing the fact that C# provides for true
> > multi-dimensional arrays where Java doesn't
>
> Ok, I confess that I didn't buy a C# compiler, but my book
> "C# in a nutshell" says there is a keyword "unsafe" that you
> can use to turn off the check. Maybe if you have a compiler you
> can try it and provide us with a demo.
>
> > (http://www.xdweb.net/~dibblego/java/faq/answers.html#q45).
> > Or perhaps using arrays in unmanaged code.
> >
> > --
> > Tony Morris
> > http://xdweb.net/~dibblego/
> >
> >
> >
>
>

Without going into detail, the unsafe keyword does a lot more than that.
"Unsafe C#" (more often referred to as unmanaged code) is analogous to
Java's JNI.
It allows the use of pointers, etc. and has the intention of allowing
existing C/C++ users to migrate over to C# i.e. run C/C++ native code from
C#.

The /unsafe compiler switch says "I know that this code does its own memory
management (etc.) and doesn't fit into the typical .NET model, but I'm
willing to accept that".

-- 
Tony Morris
http://xdweb.net/~dibblego/


Relevant Pages

  • Re: Buffer Overflow Errors
    ... Maybe if you have a compiler you ... > Or perhaps using arrays in unmanaged code. ... > Tony Morris ...
    (comp.lang.java.programmer)
  • Re: C# vs C++ regarding DirectX
    ... > if you want to build applications with .NET DirectX, ... one compiler could expose CLR features another language ... Managed C++ makes interop with unmanaged code a breeze. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: C# and my indispensable inline assembly code
    ... The unmanaged code would need to be compiled and linked and the ... managed code would need a ref to it. ... include the unmanaged dll into the exe like ilmerge does or something to do ... >> produced by the C# compiler is secure/verifiable code and this is ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: VCL.NET revisited...
    ... DevCo must support Third-Party vendor to continue to it ... that was developed as an escape platform from unmanaged Delphi W32 ... the unmanaged code is not going away. ... Microsofts designer and Delphi.NET compiler. ...
    (borland.public.delphi.non-technical)
  • Re: Can you write code directly in CIL ???
    ... >> so I must do at least as well as the best compiler. ... >> of translating the generated assembly language from the best unmanaged code ... the execution paths would have to result in at least somewhat faster code. ... Some instructions can now be paired to execute concurrently. ...
    (microsoft.public.dotnet.languages.csharp)