Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I wonder how many .NET developers have a working knowledge of CIL and where it has been useful to them.

In case you are missing my meaning, here is a simple CIL example to add two locations together:

ldloc.0
ldloc.1
add
stloc.0    // a = a + b or a += b;
share|improve this question
1  
confused: question title has absolutely nothing to do with CIL. What are you asking about? In-depth knowledge of the Runtime or the Intermediate Language? –  qes Apr 11 '11 at 18:51
1  
It's about both; you cannot have CIL without CLR. –  Carnotaurus Apr 11 '11 at 18:57
3  
When I start micro-optimizing, I remind myself the guys that wrote the compiler are a lot smarter than I'll ever be. –  Wyatt Barnett Apr 11 '11 at 19:02
    
The above code is magic to me. –  The Muffin Man Apr 11 '11 at 19:20
    
@Nick: "With CIL the previous lines of code matter in that these are used as parameters for the add instruction" [ Source: carnotaurus.tumblr.com/post/2455409003/… ] –  Carnotaurus Apr 11 '11 at 19:27

3 Answers 3

up vote 7 down vote accepted

The times I've had to use reflector or dip into IL have always been due to code smell. Two times in particular I recall:

  1. I was using a poor debugging method which resulted in a variable being optimized out by the compiler

  2. The original code was lost. Reflector did little to recover the code. The time it would have taken me to piece the code back to read-able form was much greater than the time it took me to rewrite it (non-obfuscated).

My point is, if you are a "normal" developer (E.G. not working at MS on the CLR source), there's very little need to scan IL. Regular developers should look at more common solutions to problems or they may be wasting a lot of time on the wrong solution or micro-optimizations.

share|improve this answer

I use it to the extent that I need to in order to follow things like Jeff Richter's book, and sometimes blog posting by the like of Eric Lippert. To that extent it is important to me so I have a good understanding of the platform as a whole.

I have (almost) never used IL directly in my "day job". However, if tools like Reflector did not exist I might have to, but thankfully the tools exist so I don't need to.

Edit - the comment below reminded me that on occassion it may be neccessary to debug in IL if you do not have source code available. I can only recal doing this once but it's certainly a scenario where some knowledge of IL is useful.

share|improve this answer
    
The sad thing is that there appears to be no debugging feature with Reflector - I'll upvote you for actually answering the question –  Carnotaurus Apr 11 '11 at 18:03
    
That's a good point, and come to think if it I have once had to debug IL without source code. –  Steve Haigh Apr 11 '11 at 19:39
    
Yes, that's happened to me but rather you than me I suppose :) –  Carnotaurus Apr 11 '11 at 19:44
  • understanding of principles is important
  • details like in you example - rather no. There are a lot of more useful knowledge to feed a brain
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.