I am reading now a great book - http://www.amazon.com/CLR-via-C-Jeffrey-Richter/dp/0735627045
One of the topic is "How Things Relate at Runtime" . Under this topic the author explain that value types are stored on the stack. I was curioues about it . so I google it and I found a lot of dicsussion about this topic and a lot of arguments either it store on the heap or stack.
Evantually i found this post - http://blogs.msdn.com/b/ericlippert/archive/2010/09/30/the-truth-about-value-types.aspx
The interesting point in the post wast the answer to the question above.
The intresting point was - why the hall do you care about where is it stored????
"It is almost always irrelevant. We've worked hard to make a managed environment where the distinctions between different kinds of storage are hidden from the user. Unlike some languages, in which you must know whether a particular storage is on the stack or the heap for correctness reasons."
DAM , He is right!!!
Some might say that they need to know this due to performance reasons, but the performance impact (in most of the cases) is so negligible , so this is not a good reason.
The few times that I need to know extreme stuff about heap vs stack were in interviews.
This question is an example to knowledge which is poplular in interviews but has no impact or use in the " real development word ".
So, if this question is irellevant to the " real life " why interviewer keep asking it?
For my opinon there are couple of reasons for this:
1. assumpation that a good developer is measured by pitfall knowledge and small low levels details.
2. This is the kind of question that I was asked , so I am asking the same question
3. The interviewer did google for interview question and found these kind of questions.
אין תגובות:
הוסף רשומת תגובה