🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #209

Re: About "int" value storage.

#209
From: Kolja
Date: Tue, 20 Jun 2006 08:09
34 lines
2763 bytes
"Marc Rohloff [TeamB]" <"on request"> wrote in message 
news:15m76f8teid2h$.dlg@dlg.marcrohloff.com...
> On Mon, 19 Jun 2006 18:39:22 +0400, Kolja wrote:
>
>> I have one stupid question which do not gove me a rest.
>> Given that "int" value datatype is represented by "struct" in unboxed
>> condition and "class ValueType" when in boxed condition.
>> Let us write in our progam: "int i = 5;" . Now plz tell me WHERE in both
>> struct or class representation store the value "5" of "int i" itself? I
>> tried to disassemble the "int i" through Reflection and found some field
>> "m_value" in it. I wonder if is it?
>
> It isn't really a struct when its unboxed, it is just the way the
> runtime sometimes represents it.
>
> -- 
> Marc Rohloff [TeamB]
> marc rohloff -at- myrealbox -dot- com

Can you elaborate?

All specifications which I red tell that the value type is a struct in 
unboxed form. It is stored in thread stack. See this: 
http://msdn2.microsoft.com/en-us/library/s1ax56ch(VS.80).aspx. Then this: 
http://msdn2.microsoft.com/en-us/library/system.int32.aspx. The System.Int32 
struct.
When it is boxed then it is moved to Heap and becomes the ValueType class.

I really confused where this System.Int32 struct stores accual value? Notice 
that if I make my own struct then I create the included members in my struct 
which carries values.
But I really wonder where Microsoft hides the value of int in System.Int32? 
I tried Reflection to clarify it and found the "m_value" member of 
System.Int32? Is this it? 
Technical Details
Message-ID: <1150790966.862793@angel.elektra.ru>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <1150727965.330076@angel.elektra.ru> <15m76f8teid2h$.dlg@dlg.marcrohloff.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,fe3051f5b35308d7
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Kolja" <kolja2003@tizcali.com>
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <1150727965.330076@angel.elektra.ru> <15m76f8teid2h$.dlg@dlg.marcrohloff.com>
Subject: Re: About "int" value storage.
Date: Tue, 20 Jun 2006 12:09:24 +0400
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2663
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663
X-RFC2646: Format=Flowed; Original
Organization: Ye 'Ol Disorganized NNTPCache groupie
Message-ID: <1150790966.862793@angel.elektra.ru>
Cache-Post-Path: angel.elektra.ru!unknown@shsv.mcc.elektra.ru
X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/)
NNTP-Posting-Host: 193.125.98.3
X-Trace: newsgroups.borland.com 1150790966 193.125.98.3 (20 Jun 2006 01:09:26 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail