What is the purpose of the “Prefer 32-bit” setting in Visual Studio and how does it actually work?

Microsoft has a blog entry What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11: In .NET 4.5 and Visual Studio 11 the cheese has been moved. The default for most .NET projects is again AnyCPU, but there is more than one meaning to AnyCPU now. There is an additional sub-type of AnyCPU, … Read more

Displaying the build date

Jeff Atwood had a few things to say about this issue in Determining Build Date the hard way. The most reliable method turns out to be retrieving the linker timestamp from the PE header embedded in the executable file — some C# code (by Joe Spivey) for that from the comments to Jeff’s article: public … Read more

How do you dynamically compile and load external java classes? [duplicate]

Take a look at JavaCompiler The following is based on the example given in the JavaDocs This will save a File in the testcompile directory (based on the package name requirements) and the compile the File to a Java class… package inlinecompiler; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.net.URL; import java.net.URLClassLoader; import … Read more

Why does changing 0.1f to 0 slow down performance by 10x?

Welcome to the world of denormalized floating-point! They can wreak havoc on performance!!! Denormal (or subnormal) numbers are kind of a hack to get some extra values very close to zero out of the floating point representation. Operations on denormalized floating-point can be tens to hundreds of times slower than on normalized floating-point. This is … Read more

Why do you have to link the math library in C?

The functions in stdlib.h and stdio.h have implementations in libc.so (or libc.a for static linking), which is linked into your executable by default (as if -lc were specified). GCC can be instructed to avoid this automatic link with the -nostdlib or -nodefaultlibs options. The math functions in math.h have implementations in libm.so (or libm.a for … Read more