C# Compiler optimization – Unused methods

Just checked in reflector with a release build. The compiler doesn’t remove the unused private methods. There are ways to use a method without the compiler knowledge, like with reflection. So the compiler doesn’t try to guess. It just leaves the methods there. The only private methods the compiler removes are partial methods without implementation. … Read more

How do I compile and run a C program in Sublime Text 2?

I recommend you to read build document of Sublime Text 2. Here is the answer. In Sublime, click Tools -> Build System -> New Build System… For Windows user, type the following code and save: { “cmd” : [“gcc”, “$file_name”, “-o”, “${file_base_name}.exe”, “&&”, “${file_base_name}.exe”], “selector” : “source.c”, “shell” : true, “working_dir” : “$file_path” } For … Read more

Why did Intel change the static branch prediction mechanism over these years?

The primary reason why static prediction is not favored in modern designs, to the point of perhaps not even being present, is that static predictions occur too late in the pipeline compared to dynamic predictions. The basic issue is that branch directions and target locations must be known before fetching them, but static predictions can … Read more

How to suppress Java compiler warnings for specific functions

If you really, really must do this, and you are sure you are not making a mistake, check out the @SuppressWarnings annotation. I suppose in your case you need @SuppressWarnings(“fallthrough”) Is the annotation @SuppressWarnings (javadoc) what you are looking for? For example: @SuppressWarnings(“unchecked”) public void someMethod(…) { … }

how do compilers assign memory addresses to variables?

The answer to this question is quite complex since there are various approaches to memory allocation depending on variable scope, size and programming environment. Stack allocated variables Typically local variables are put on the “stack”. This means that the compiler assigns an offset to the “stack pointer” which can be different depending on the invocation … Read more

Python distutils, how to get a compiler that is going to be used?

This is an expanded version of Luper Rouch’s answer that worked for me to get an openmp extension to compile using both mingw and msvc on windows. After subclassing build_ext you need to pass it to setup.py in the cmdclass arg. By subclassing build_extensions instead of finalize_options you’ll have the actual compiler object to look … Read more