[Mono-dev] "fixed" as modifier
Jonathan Pryor
jonpryor at vt.edu
Mon Jul 24 05:55:24 EDT 2006
On Mon, 2006-07-24 at 02:03 +0200, Jakob Petsovits wrote:
> I'm currently writing a C# LL parser for KDevelop, and use the numerous Mono
> source files as test cases for the parser. I've mainly been following the
> C# specification, and found something in the Mono sources conflicting with it:
>
> In mcs/tests/gtest-166.cs, there are field declarations where "fixed" is not
> used as statement, but as modifier for the variable. Quote:
>
> public unsafe struct TestNew {
> private fixed char test_1 [128];
> public fixed bool test2 [4];
>
> public fixed int T [2];
> public fixed bool test20 [4], test21 [40];
>
> (...)
> }
...
> Should this be compilable even if it's not specified? Is it a mono bug?
> Can someone tell me more about this?
`fixed' in this context is a Microsoft extension which Mono supports;
see:
http://msdn2.microsoft.com/en-us/library/zycewsya.aspx
http://msdn2.microsoft.com/en-us/library/t2yzs44b.aspx
http://www.mono-project.com/Dllimport#C.23_2.0_Functionality
It allows for simple and efficient fixed-size buffers (the alternatives
are mentioned at
http://www.mono-project.com/Dllimport#Arrays_Embedded_Within_Structures).
I'm not sure why it hasn't been standardized yet.
- Jon
More information about the Mono-devel-list
mailing list