compiler

What's safe for a C++ plug-in system?

Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compilers to create plug-ins for a host application using a simple interface. L...

Tools for converting non-Java into Java source

Are there any good tools out there for automatically converting non-Java source code into Java source? I'm not expecting something perfect, just to get the worst of the grunt work out of the way. I guess there is a sliding scale of difficulty. C# should be relatively easy (so long as you ignore all the libraries). (well written) C++ no...

profile-guided optimization (C)

Anyone know this compiler feature? It seems GCC support that. How does it work? What is the potential gain? In which case it's good? Inner loops? (this question is specific, not about optimization in general, thanks) ...

Which compiles to faster code: "n * 3" or "n+(n*2)"?

Which compiles to faster code: "ans = n * 3" or "ans = n+(n*2)"? Assuming that n is either an int or a long, and it is is running on a modern Win32 Intel box. Would this be different if there was some dereferencing involved, that is, which of these would be faster? long a; long *pn; long ans; ... *pn = some_number; ans = ...

Java Compiler Options to produce .exe files.

What compiler (I'm using gcj 4.x) options should I use to generate an "exe" file for my java application to run in windows? ...

Using the DLR for (primarily) static language compilation...

I'm building a compiler that targets .NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of the code is completely static. So now that that's been explained, I have ...

C (or any) compilers deterministic performance

Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and that the compiler is fully deterministic? To this question I ha...

Flexible compiler pipeline definitions...

I'm developing a compiler framework for .NET and want a flexible way of defining pipelines. I've considered the following options: WWF Custom XML pipeline description Custom pipeline description in code (using Nemerle's macros to define syntax for it) Other code-based description Requirements: Must not depend on functionality only...

.Net 2+: why does if( 1 == null ) no longer throw a compiler exception?

I'm using int as an example, but this applies to any value type in .Net In .Net 1 the following would throw a compiler exception: int i = SomeFunctionThatReturnsInt(); if( i == null ) //compiler exception here Now (in .Net 2 or 3.5) that exception has gone. I know why this is: int? j = null; //nullable int if( i == j ) //this s...

Are there any advantages compiling for .NET Framework 3.5 instead of 2.0?

Are there any advantages compiling for .NET Framework 3.5 instead of 2.0? For example less memory consumption, faster startup, better performance... Personally I don't think so however, I may have missed something. Edit: Of course there are more features in the 3.5 framework, but these are not the focus of this question. Edit2: There...

Why do we need extern "C"{ #include <foo.h> } in C++?

Specifically: When should we use it? What is happening at the compiler/linker level that requires us to use it? How in terms of compilation/linking does this solve the problems which require us to use it? ...

Good way to learn Scala?

I've recently become interested in learning Scala, my first thought was a simple compiler, but I don't have very good knowledge of Automata theory. So my question is: what's a good project or tutorial to learn scala with? ...

What's a good resource for starting to write a programming language, that's not context free?

I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free. ...

Why don't we get a compile time error even if we don't include stdio.h in a C program?

How does the compiler know the prototype of sleep function or even printf function, when I did not include any header file in the first place. Moreover, if I specify sleep(1,1,"xyz") or any arbitrary number of arguments, the compiler still compiles it. But the strange thing is that gcc is able to find the definition of this funciton at ...

Why does a C/C++ program often have optimization turned off in debug mode?

In most C or C++ environments, there is a "debug" mode and a "release" mode compilation. Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it also disables most optimizations. In "release" mode, you usually have all sorts of optimizations turned o...

How to infer coercions?

I would like to know how to infer coercions (a.k.a. implicit conversions) during type inference. I am using the type inference scheme described in Top Quality Type Error Messages by Bastiaan Heeren, but I'd assume that the general idea is probably the same in all Hindley-Milner-esque approaches. It seems like coercion could be treated a...

How to compile a java application which uses Google webdriver from comand line without ant

Hi, I want to compile an example code which using google`s webdriver. I saved webdriver into /home/iyo/webdriver. My code is: package com.googlecode.webdriver.example; import com.googlecode.webdriver.By; import com.googlecode.webdriver.WebDriver; import com.googlecode.webdriver.WebElement; import com.googlecode.webdriver.htmlun...

"No newline at end of file" compiler warning

What's the reason for the "No newline at end of file" warning in some C++ compilers? What's good about having an empty line at the end of a source\header file? ...

How did you learn the GNU make tools?

I've been a professional web developer for about five years now, and have compiled many many things for servers. I've also written many simple C programs (one or two files). The main thing which has held me back from creating more complex applications is the fear of leraning to the GNU build tools. The documentation is huge and a bit in...

What are some good compilers to use when learning C++?

What are some suggestions for easy to use C++ compilers for a beginner? Free or open-source ones would be preferred. ...