IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.27 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-06-15
Pages: < Prev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Next >
[17:22]<mjzymygo>they are handled differently by the CLR internally
[17:22]<jjxgdjn1o9>that's the definition of a value type, its placed on the stack
[17:22]<svzz[wjzc]>Moridin8 i'm looking at the ildasm of where i call my .FillCombo() method, and the FillCombo() method itself, and frankly, all i see is my code written in more complex calls
[17:22]<mjzymygo>Staz: follow it thru
[17:22]<drdyrrrq>page 135 of applied .net framework programming by ms disagrees with your Moridin8
[17:23]<azyfm>new SomeStruct() in a method will *not* allocate on the heap
[17:23]<mjzymygo>damieng; then talk to Serge Lidin... ;)
[17:23]<drdyrrrq>CLR offers lightweight types called value types ... uusually allocated on the stack unless embedded in a reference type.
[17:23]<svzz[wjzc]>Moridin8 follow what?
[17:23]<jjxgdjn1o9>but even if its inside a reference type its allocated in the same frame as the instance as opposed to being yet another reference within the parent instance
[17:24]<azyfm>yes
[17:24]<jjxgdjn1o9>Moridin8: http://msdn2.microsoft.com/en-us/library/s1ax56ch.aspx
[17:24]<drdyrrrq>page 137 also shows clear diagrams of the thread stack and managed heap and how 'structs' are on the stack and classes are in the heap.
[17:24]<drdyrrrq>structs only end up on the heap when used as part of a class.
[17:24]<jjxgdjn1o9>damieng2: page 137 of what, just link him to MSDN like i did
[17:25]<drdyrrrq>of Applied Microsoft .NET Framework Programming.
[17:25]<jjxgdjn1o9>damieng2: hey i noticed that page says you cant use local variables before they are initialized?
[17:25]<drdyrrrq>http://www.amazon.com/gp/product/0735614229/102-7597766-7735306?v=glance&n=283155
[17:26]<jjxgdjn1o9>damieng2: is that different from class variables which seem to be initialized to their default variables when a class is instantiated?
[17:26]<drdyrrrq>structs auto initialize to 0
[17:26]<jjxgdjn1o9>interesting, learned something new today.. i thought local vars initialized to 0 too
[17:26]<drdyrrrq>it's up to the struct developer to ensure 0 means something useful
[17:27]<jjxgdjn1o9>http://msdn2.microsoft.com/en-us/library/system.valuetype.aspx
[17:27]<jjxgdjn1o9>"Value types are either stack-allocated or allocated inline in a structure."
[17:27]<drdyrrrq>yeah thats what i said
[17:27]<jjxgdjn1o9>you didnt say the 2nd part, i did ;)
[17:27]<jjxgdjn1o9>either way, undeniable proof in terms of MSDN
[17:27]<drdyrrrq>04damieng-work: 01structs only end up on the heap when used as part of a class.
[17:27]<drdyrrrq>guess you missed that.
[17:27]<jjxgdjn1o9>um
[17:28]<svzz[wjzc]>Moridin8 i really don't see what's so special in that code, it's a pure transcription of mine, as far as i can see: here the c# and ildasm code : http://rafb.net/paste/results/BLhBDE83.html
[17:28]<jjxgdjn1o9>thats not clear enough
[17:28]<drdyrrrq>is to me.
[17:28]<jjxgdjn1o9>damieng2: it could be part of the heap as an embedded reference, or it could be in the heap inline
[17:29]<drdyrrrq>i'm quite aware on how stacks, value type and reference types work.
[17:29]<drdyrrrq>i'm not the one having problems here.
[17:29]<azyfm>the use of new to allocate a value type only seems wreird if you start from the wrongful assumption that new means heap allocation
[17:29]<jjxgdjn1o9>yes... why are you getting defensive? i'm just saying you didnt express yourself clearly
[17:29]<drdyrrrq>god damn this channel gets so whiney
[17:29]<jjxgdjn1o9>you're the one whining
[17:30]<drdyrrrq>no, i was trying to help clarify value types for you.
[17:30]<svzz[wjzc]>(if you look at my code please ignore the line 21 and 22¸
[17:30]<jjxgdjn1o9>lmao
[17:30]<drdyrrrq>if you don't want that help, np.
[17:30]<sjlx>hf
[17:31]<sjlx>it is spelled with S and not with a dollar sign.
[17:31]<jjxgdjn1o9>[09:21] <JohnDoe384> btw im just complaining about syntax dont mistake me for not understand the difference
[17:31]<sjlx>JohnDoe384: cut it.
[17:31]<azyfm>int i = new int(); <= perfectly legal
[17:32]<bfjrvnmup>hey
[17:32]<bfjrvnmup>how do i know when a Socket
[17:32]<bfjrvnmup>is connected on a remote source
[17:32]<bfjrvnmup>or not ?
[17:32]<azyfm>when a socket comes marching in?
[17:32]<bfjrvnmup>i Tryed if (socket.Connected)
[17:32]<bfjrvnmup>but even if its not connected
[17:32]<bfjrvnmup>its saying it is !
[17:33]<bfjrvnmup>(im using a asynchronous client) :p
[17:33]<svzz[wjzc]>setting the Combobox DataSource and ValueMember both triggers the SelectedValueChanged event... while imo none should trigger this other than a user, a databinding or a direct affectation
[17:33]<jjxgdjn6n1>sheesh, you ask a syntax question and people start to explain something else totally different
[17:34]<azyfm>JohnDoe793: Your question was wrong since you started from the wrong assumption
[17:35]<jjxgdjn6n1>hows that? you dont use new in Cpp to allocate memory from the **stack**
[17:35]<azyfm>notice the name of the channel - ##csharp, not ##c++
[17:35]<drdyrrrq>thats because their structs can't have constructors.
[17:35]<azyfm>it's c++ that's inconsistent, not c#
[17:35]<jjxgdjn6n1>C# clearly derives from Cpp, its got most of its feature set
[17:36]<jjxgdjn6n1>and i even said "traditionally"
[17:36]<jjxgdjn6n1>damieng2: i'm not sure what that was in reference to? you can have a class on the stack in Cpp just the same
[17:36]<azyfm>C# isn't C++, it's as simple as that
[17:37]<jjxgdjn6n1>funny, new in Cpp was consistent.. allocate dynamic memory
[17:37]<azyfm>and in C# it means "create new instance"
[17:37]<drdyrrrq>then go program in C++
[17:37]<azyfm>huh, wonder which one makes sense
[17:37]<jjxgdjn6n1>ok and enlighten me what happens to a struct if I dont call new?
[17:38]<azyfm>it doesn't get created
[17:38]<azyfm>you can't do int i; Console.Writeline(i); either
[17:38]<azyfm>because the variable i won't have been initialized
[17:38]<azyfm>int i = new int(); Console.Writeline(i); is legal
[17:38]<mjzymygo>ok.... I read something and use it as fact, read something else (in this case by Serge Lidin) and get confused
[17:38]<azyfm>it's perfectly consistent
[17:38]<mjzymygo>then I open my mouth using said crap confusion
[17:38]<mjzymygo>then I go and re-read and then get it
[17:39]<azyfm>the only difference is that you have literal representations of primitives
[17:39]<mjzymygo>Damieng is totally correct
[17:39]<drdyrrrq>:)
[17:39]<jjxgdjn6n1>Arild: ok so how come I was able to type this into VS and compile it
[17:39]<mjzymygo>the 'new' keyword when used on structs does actually throw SOMETHING on 'a' heap
[17:39]<mjzymygo>but not the value itself
[17:39]<mjzymygo>that is on the stack
[17:39]<bfjrvnmup>how do i know when a Socket is connect to a remote host or not ? im trying to use Socket.Connected property but its giving me the wrong answer... saying it IS connected when its not after using BeginConnect call back :|
[17:39]<jjxgdjn6n1>Arild: struct bar { public int foo;} bar Bar; Bar.foo = 1; return Bar;
[17:40]<mjzymygo>the wrapper object itself is used using a pointer reference to the stack to enact is work
[17:40]<mjzymygo>the wrapper object being the struct methods/accessors etc.
[17:40]<azyfm>I t hink you're being confused again, Moridin8
[17:41]<drdyrrrq>structs don't have a full vmt which is why they can't inherit.
[17:41]<mjzymygo>damieng: totally.
[17:42]<azyfm>doesn't compile for me, JohnDoe793
[17:42]<azyfm>hm, it does
[17:42]<pzw>seems pain in the arse to use Invoke :/
[17:42]<mjzymygo>serge Lidin: "To access instance members of a value-type class, we provide the managed pointer to the value type that lives on the stack'







