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.28 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:43]<jjxgdjn6n1>Arild: structs dont need to be instantiated, they already exist on the stack.... http://pastebin.com/710782
[17:44]<azyfm>they do need to be initialized - remove the Bar.foo = 1; and it won't compile
[17:45]<mjzymygo>.locals init (int32 j)
[17:45]<mjzymygo>ldc.i4 123456 // Load constant onto op-stack
[17:45]<mjzymygo>stloc J // store in locals stack
[17:45]<mjzymygo>ldloca J // get address of J
[17:45]<mjzymygo> // Then call the instanced method on Int32 wrapper class
[17:45]<mjzymygo>call instance string [mscorlib]System.Int32:ToString();
[17:45]<jjxgdjn6n1>initialized and instantiated, not the same words?
[17:45]<mjzymygo>.locals init (int32 j)
[17:45]<mjzymygo>ldc.i4 123456 // Load constant onto op-stack
[17:45]<mjzymygo>stloc J // store in locals stack
[17:45]<mjzymygo>ldloca J // get address of J
[17:45]<mjzymygo> // Then call the instanced method on Int32 wrapper class
[17:46]<mjzymygo>call instance string [mscorlib]System.Int32:ToString();
[17:46]<drdyrrrq>argh, ilasm ;-)
[17:46]<svzz[wjzc]>is there a tool i can use to see exactly what events are raised at a certain poin?
[17:46]<jjxgdjn6n1>maybe if I knew ilasm i'd look at it
[17:46]<azyfm>StaZ[work] - Your memory is weak :-P
[17:46]<mjzymygo>the System.Int32 (that inherits ValueType) *does* live on the Heap.
[17:46]<mjzymygo>but the values it uses live on the stack
[17:47]<svzz[wjzc]>Arild if you talk about ildasm i don't see at all where events triggered are written in there
[17:47]<azyfm>StaZ[work]: http://ankhsvn.com/svn/Utils/trunk/Utils/Debugging/DebugUtils.cs
[17:47]<svzz[wjzc]>oh yeah that
[17:47]<svzz[wjzc]>heh sorry
[17:47]<svzz[wjzc]>:S
[17:47]<svzz[wjzc]>thanks
[17:47]<mjzymygo>ergo with every struct class, it's the same.
[17:47]<bfjrvnmup>?
[17:47]<bfjrvnmup>?
[17:48]<mjzymygo>so new *does* create your struct class on the heap, but only for when you are using it's onstance based methods
[17:48]<mjzymygo>(onstance = instance)
[17:48]<mjzymygo>but all the data inside it are instantly thrown on the stack
[17:48]<azyfm>no, new doesn't
[17:48]<azyfm>the call does
[17:48]<mjzymygo>arild: nope
[17:48]<mjzymygo>not according to Serge
[17:49]<jjxgdjn6n1>i suppose if all value types need to be initialized before they are used, this struct behaviour makes sense
[17:49]<drdyrrrq>anyway, as thrilling as this is I'm off to see the house i'm buying. bbl.
[17:49]<mjzymygo>the first time a struct is used, an instance is created that lives on a stack
[17:49]<mjzymygo>(heap)
[17:49]<mjzymygo>doh!
[17:49]<jjxgdjn6n1>then again, i dont see why value types cannot be initialized to a default value in the first place like in D
[17:49]<azyfm>that's what the parameterless ctor is for
[17:49]<svzz[wjzc]>Arild, may i ask... what's the Fines.Utils.Collections it's a namespace of yours?
[17:49]<azyfm>yes
[17:50]<azyfm>er, Collections?
[17:50]<jjxgdjn6n1>Arild: doesnt matter, you still have to call the new operator
[17:50]<drdyrrrq>not for arrays
[17:50]<jjxgdjn6n1>I think I will dive into some ilasm, what program can I use to deassemble my code
[17:50]<svzz[wjzc]>Arild yeah seems the one defined ListUtils.map
[17:50]<azyfm>oh, right
[17:50]<mjzymygo>John: reflector
[17:50]<azyfm>http://ankhsvn.com/svn/Utils/trunk/Utils/
[17:50]<mjzymygo>By Lutz Roeder
[17:50]<azyfm>it's all there
[17:50]<drdyrrrq>individual array items of value types don't need or run constructors
[17:51]<mjzymygo>no they don't at all. =)
[17:51]<mjzymygo>they just occupy memory that could be full of junk
[17:51]<azyfm>value types are meant to be "blittable"
[17:51]<drdyrrrq>no, they're zeroed
[17:51]<azyfm>that means they can be copied by just doing a memcpy, and they can be initialized with a memzero
[17:51]<drdyrrrq>.net framework design guidelines tells you to ensure your struct classes have good meaning with 0 values.
[17:52]<drdyrrrq>i.e. if you were to have a type that displayed a number from 1 to 10
[17:52]<drdyrrrq>they recomment that the property that exposes that value exposes the internal value + 1
[17:52]<drdyrrrq>so that you don't need a .ctor
[17:53]<mjzymygo>does it zero them? hmm... strange, so what was I pulled out last week????
[17:53]<mjzymygo>*goes to check a little experiment of mine...*
[17:53]<drdyrrrq>.net 0.5 alpha? ;-)
[17:54]<azyfm>wasn't it "Next Generation Windows Services" back then?
[17:54]<drdyrrrq>i thought it had a silly codename with some cartoon animal mascot
[17:54]<svzz[wjzc]>huh, Arild that's sure is an awesome tool, i just realised that my combobox's BindingContextChanged event is raised... though it's not bound at all to anything... winforms has some dirty secrets under the hood...
[17:55]<drdyrrrq>i hate winforms.
[17:56]<svzz[wjzc]>lol... so much event raised for no reason... wowq
[17:56]<azyfm>you got DebugEvents working, StaZ[work]?
[17:56]<svzz[wjzc]>ClientSizeChanged is called 5 times during the form loading
[17:56]<svzz[wjzc]>Arild yeah works #1
[17:58]<svzz[wjzc]>and setting .DataSource of my combobox raises TextChanged, SelectedValueChanged and SelectedIndexChanged... still makes no sense to me
[17:58]<azyfm>why not?
[17:58]<jjxgdjn6n1>Arild: looking at the msil code for struct instantiation, if you merely initialiaze the struct variables without calling new, it doesnt call any ctors, it looks like the compiler is stubborn and simply wont let you use uninitialized values
[17:58]<svzz[wjzc]>because my combobox has no value, it just been created, why would filling it's items set a value?
[17:58]<azyfm>what if .SelectedIndex = 10, and you set .DataSource to a collection with only three items
[17:59]<irbmn>http://www.nomorepasting.com/paste.php?pasteID=63796 - the problem is described on line 83. Could somebody take a look and tell me if they see what the problem could be?
[17:59]<azyfm>right
[17:59]<svzz[wjzc]>Arild yeah in that case it does make sense, but having my combobox newly create with nothing, it makes no sense
[18:00]<mjzymygo>uhn.... John: the CLR will call a default constructor no mater what on vaue types, even if it's the one that lives in ValueType
[18:00]<svzz[wjzc]>and those are the 3 events i can use to capture the User entry, so what i have to put a flag, "is loaded" so when the event trigger i don't do anything until is loaded is set to true
[18:00]<svzz[wjzc]>?
[18:00]<azyfm>it won't CALL anything
[18:00]<azyfm>you can't define your own default ctor for a value type
[18:00]<azyfm>so there's nothing to call
[18:01]<azyfm>the CLR will only blank out the memory occupied by the type
[18:02]<hzzmbyv>Hi! p4tux
[18:02]<jjxgdjn6n1>Moridin8: look at the IL yourself, it doesnt call a ctor unless you call one yourself
[18:03]<mjzymygo>John/Arild: yeh... just read that ;) it's not called implicitly
[18:11]<vxyzmly2z>so i have this class that is huge. i need a way to set a flag and only do a certain thing under certain conditions. is there a way to save the value of the flag without turning the class into a singleton?
[18:12]<azyfm>huh
[18:15]<azyfm>You're more likely to get an answer if you summarize the problem in here, methinks
[18:17]<irbmn>Well, it's hard to summarize the problem hence me pasting the code there, but basically I'm getting a NullReferenceException and I don't understand why - it's a threading/synchronization issue
[18:17]<jjxgdjn6n1>pasting code is alwys a win







