Is it possible to install a C# compiler without Visual Studio?

Sure, the framework includes a compiler, csc.exe. Look at this article for a quick how-to. The important parts: You can get the command-line compiler (csc.exe) from Microsoft site http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx. Download the redistributable package of the .NET Framework, which includes the compiler and the .NET Framework with C# 2005 syntax support. The compiler is located in … Read more

Multiple parameter closure argument type not inferred

See this scala-debate thread for a discussion of what’s going on here. The problem is that Scala’s type inference happens per parameter list, not per parameter. As Josh Suereth notes in that thread, there’s a good reason for the current approach. If Scala had per-parameter type inference, the compiler couldn’t infer an upper bound across … Read more

Are Fortran control characters (carriage control) still implemented in compilers?

In years past, ignoring this use of the first column could cause bad things on a line printer, like page ejects — but when was the last time that you saw a line printer? Otherwise it was output device, compiler and OS dependent. The advice of “Fortran 95/2003 for Scientists and Engineers” was excellent for … Read more

What Rules does compiler have to follow when dealing with volatile memory locations?

What you know is false. Volatile is not used to synchronize memory access between threads, apply any kind of memory fences, or anything of the sort. Operations on volatile memory are not atomic, and they are not guaranteed to be in any particular order. volatile is one of the most misunderstood facilities in the entire … Read more

Fun with uninitialized variables and compiler (GCC)

I’m just curious to know why this sudden change in the behavior of uninitialized bool? Disassemble the code and see what the compiler’s doing. My guess: since the value is now only used locally, the compiler optimizes it away completely. Since the behaviour is undefined anyway, the compiler can safely just assume any value, e.g. … Read more

C# – Value Type Equals method – why does the compiler use reflection?

The following is the decompiled ValueType.Equals method from mscorlib: public override bool Equals(object obj) { if (obj == null) { return false; } RuntimeType type = (RuntimeType) base.GetType(); RuntimeType type2 = (RuntimeType) obj.GetType(); if (type2 != type) { return false; } object a = this; if (CanCompareBits(this)) { return FastEqualsCheck(a, obj); } FieldInfo[] fields = … Read more