compiler

Get typedef of current class

Hi there, I'm currently using boost::intrusive_ptr together with my GUI classes. Although this is more or less a convenience question, is there a proper way to get the typename of the current class? The reason I'm asking is that I have a macro for typedef'ing the different pointer types: #define INTRUSIVE_PTR_TYPEDEFS(CLASSNAME) typede...

Methods for avoiding common typo bugs

So I just spent the last few hours pouring over code trying to figure out the source of a bug only to find that my error was none other than the obviously wrong but compiler accepted: if (a = b) where it should have been if (a == b) What do you guys do to safeguard against these frustrating errors? What other common "obviously wro...

C++ compiler differences

What's the difference on the VC++.net complier (cl.exe /EHsc) and the GCC compiler, compiling, let's say this program: #include <iostream> using namespace std; int main(){ unsigned int test; cin >> test; cout << test; return 0; } I know that the vc++ compiler compiles to an exe, and gcc is compiling to the linux executable, and t...

Portable branch prediction hints

Is there any portable way of doing branch prediction hints? Consider the following example: if (unlikely_condition) { /* ..A.. */ } else { /* ..B.. */ } Is this any different than doing: if (!unlikely_condition) { /* ..B.. */ } else { /* ..A.. */ } Or is the only way to use compiler specific hints? (e.g....

gcc compiled code on visual studio

Hi, Assume I have source code for a lib/tool that works on gcc compiler. Can I use the same code and compile it in visual studio. will that be possible at all? If it is possible, how do I do it? ...

Dealing with the example.cpp in CRF++ toolkit

Hi, I am just starting to learn about the use of CRF++ toolkit. I downloaded the linux version of CRF++ 0.54 , When i try to compile the example.cpp under sdk/ with the command g++ -o example example.cpp there comes the problem: hpl@hpl-desktop:~/Documents/CRF/CRF++-0.54$ g++ -o a example.cpp /tmp/ccmJQgGu.o: In function main': exampl...

configure java compiler so that it gives an error on missing annotations

hello, how can i configure the javac compiler to give an error instead of a warning when an annotation like @Override is missing? it should work on java 5. ...

VS2008(+?) compiler bug with templated functions and 'using namespace'

I've found this odd case of some code (below) doesn't compile under Visual Studio 2008 and produces an "error C2872: 'Ambiguity' : ambiguous symbol" on line 12. Removing the using namespace RequiredNamespace on the last line fixes the error, but I'd expect that putting using namespace at the end of a file should have no effect. It also...

Are printf/sprintf compiler warnings a conceptual break?

I have noticed that a large number of C compilers issue warnings when the conversion specifiers in the format string of the printf/sprintf functions do not match the type or the count of the corresponding arguments. That seems to me like a conceptual break since C doesn't have built-in functions according to the language specification. ...

Micro Focus Visual Cobol debug build, pdb and idy files don't match

I'm having an issue with compiled visual cobol code from our automated build server. When I go to attach the VS2010 debugger to the cobol program, it prompts for a .idy file but in my case the file has a " appended to it. The output idy files don't have a " in the filename and I don't know where in the build process the reference to th...

Implications of deploying a Debug build of an application?

I would like to know the pros and cons for deciding to deploy an application which was built in Debug (with debug symbol table) and opposed to Release mode where the symbols are stripped. There are other permutations like turn on optimisations for Debug and turning on debug symbols for Release. The areas which I think may be of concern ...

How does Xcode's linker decide where to look for frameworks?

Now I know there are certain standard paths in which the linker looks for frameworks, but where does get it's instructions from, to look in other custom paths? The problem I've got is a warning, something like this: ld: warning: directory '/Path/to/my/Xcode/Project/../../../../../some/other/src/path/no/longer/in/use' following -F not f...

How to compile C# Webapplication without VS ?

Is it possible to publish a web application without visual studio ? If i got all my file on a compiling server without visual studio, is it possible to compile my files with command promp or something like that ? ...

cmake - How to set different variables for Intel compiler

Hey there, I do have a simple cmake project (on linux) that loads some libraries from custom places. I now would like to use the Intel compiler instead of the gnu compiler and add some if statement to my CMakeLists.txt that loads different libraries based on the type of compiler used. So I would specify the usage of the Intel compiler ...

g++ version compatibility

This is a specific gcc related question. I have a library compiled with g++ 4.1.2 that I want to give the user. The user can use our API in their code and link our library to create the final executable. The question I have is related to g++ version compatibility. Some of our users are using g++ 4.4.3, others 4.3.3, and still others 4.2...

Examples of CLR compiler optimizations

I'm doing a presentation in few months about .Net performance and optimization, I wanted to provide some samples of unnecessary optimization, things that will be done by the compiler anyways. where can I find some explanation on what optimizations the compiler is actually capable of maybe some before and after code? ...

What is the precise definition of a lookahead set?

I'm toying around with writing compilers and learning about the theory behind syntax analysis. I've found that even though it's a key concept for understanding recognition algorithms, information about it on the net is fairly poor. It seems StackOverflow is in a unique position to fix this problem. ...

Is there a more modern, OO version of "Let's Build a Compiler"?

Is there a more modern, maybe object-oriented, equivalent to Jack Crenshaw's "Let's Build a Compiler" series? A while back I stumbled across "Let's Build a Compiler" and could just not resist writing some code. I wrote a recursive-descent C compiler in C# that output .NET CIL. "Write once, leak everywhere" was my slogan. Too bad I di...

Any compiler which takes 'char' as 'unsigned' ?

hi, Is there any C compiler which takes the default type of char as unsigned unless explicitly mentioned by the user in the file or project settings? /Kanu_ ...

Writing a temporary compiler to write a compiler in the new language

What is the term used to refer to when you create a new language and write the compiler for that language, in a different one, then once the 'temporary' compiler is well-developed, rewrite it in the same language using that temporary compiler? ...