Copy, unless the parameter is passed by reference. Thomas Tomiczek THONA Software & Consulting Ltd. (Microsoft MVP C#/.nET) (CTO PowerNodes Ltd.)
> -----Original Message----- > From: Unmoderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of Arlie Davis > Sent: Sonntag, 16. Mai 2004 20:51 > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Large structures > > I have a few questions for the advanced CLR people here. I > haven't been able to find any satisfactory answers elsewhere. > > Consider value types / structures in CLR, and passing them as > arguments to methods. Does the MS CLR *always* copy the > entire structure onto the stack? > Or does it ever simply pass a pointer to the structure? > > I like value types. However, structures of any significant > size are just impractical, if they must always be copied. > For example, in managed DirectX, nearly all of the matrix > manipulation methods take "Matrix foo" as an argument, never > "ref Matrix foo". These matrices are 4x4 floats, which means > that 64 bytes must be copied for every single matrix that is > passed into a method. > > This seems like a big waste of time, compared to the same > thing in C++, where you would simply always pass a pointer to > the matrix. Does the CLR actually pass an entire Matrix on > the stack? Or just a pointer? > > It seems like it would be within the specification / > requirements of the CLR to allow a CLR implementation to do > this, if it realizes that the method never alters the > structure, only examines its fields. > > Any insight is appreciated. > > -- arlie > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > Some .NET courses you may be interested in: > > NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles > http://www.develop.com/courses/gaspdotnetls > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com