compiler

Execution speed of references vs pointers

I recently read a discussion regarding whether managed languages are slower (or faster) than native languages (specifically C# vs C++). One person that contributed to the discussion said that the JIT compilers of managed languages would be able to make optimizations regarding references that simply isn't possible in languages that use po...

Java inner class .class file names

If I have an inner class, like this: public class Test { public class Inner { // code ... } public static void main(String[] args) { // code ... } } When I compile it, I expect it should generate two files: Test.class Test$Inner.class So why do I sometimes see classfiles like SomeClass$1.class, ev...

Need a c++ compiler to work with libraries (boost, ...)

Currently I`m using Visual Studio for writing code in C++. But it seems so weighty that I decided to switch for another one, preferably free, not so strict to system resources (I mean memory, of course) as VS to learn libraries, such as Boost and Qt. What compiler do you suggest? ...

C/C++ Compiler for windows

I'm trying to port a Linux app to windows. Nothing huge, just a small command line utility. However, the last time I worked with C in Windows, it was a 'hello world' app in Visual Studio 6. I'm trying to avoid meeting a new IDE, so I'd like to use Netbeans' C/C++ plugin. I just need a compiler. Can anyone suggest a free 32-bit compi...

Inadvertent use of = instead of ==

It seems that if (x=y) { .... } instead of if (x==y) { ... } is a root of many evils. Why don't all compilers mark it as error instead of a configurable warning? I'm interested in finding out cases where the construct if (x=y) is useful. ...

Best compiler warning level for C/C++ compilers?

What compiler warning level do you recommend for different C/C++ compilers? gcc and g++ will let you get away with a lot on the default level. I find the best warning level for me is '-Wall'. And I always try to remove fix the code for the warnings it generates. (Even the silly ones about using parenthesis for logical precedence rule...

How does a Java compiler parse typecasts?

A simple expression like (x) - y is interpreted differently depending on whether x is a type name or not. If x is not a type name, (x) - y just subtracts y from x. But if x is a type name, (x) - y computes the negative of y and casts the resulting value to type x. In a typical C or C++ compiler, the question of whether x is a type or...

Unable to create temporary files while compiling

I find increasingly now when I am building a large project, I get the following error. fatal error C1083: Cannot open compiler intermediate file: 'C:\Temp\SYS\a03132ex': Permission denied It occurs in Visual Studio 2003 and VC6, and I have investigated the potential MSDN reasons and drawn a blank. There is plenty of space ...

What makes the Java compiler so fast?

I was wondering about what makes the primary Java compiler (javac by sun) so fast at compilation? ..as well as the C# .NET compiler from Microsoft. I am comparing them with C++ compilers (such as G++), so maybe my question should have been, what makes C++ compilers so slow :) ...

Why are compilers so stupid?

I always wonder why compilers can't figure out simple things that are obvious to the human eye. They do lots of simple optimizations, but never something even a little bit complex. For example, this code takes about 6 seconds on my computer to print the value zero (using java 1.6): int x = 0; for (int i = 0; i < 100 * 1000 * 1000 * 1000...

What compilers besides gcc can vectorize code?

GCC can vectorize loops automatically when certain options are specified and given the right conditions. Are there other compilers widely available that can do the same? ...

Introduction to Static Analysis

I'm a self taught programmer with almost non CS background. I'm currently learning about parsing techniques/algorithms/tools, and have a desire to build programs to analyze Java code. What kind of mathematical/theoretical CS do you have to know or take into account to build the most basic static analysis tools? A very simple thing that ...

Compiling with g++ using multiple cores

Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? Many thanks. ...

implementing type inference

well I see some interesting discussions here about static vs. dynamic typing I generally prefer static typing, due to compile type checking, better documented code,etc. However I do agree that they do clutter up the code if done the way Java does it, for example. so Im about to start building a language of my own and type inference is ...

Getting a Signature Mismatch Error when Compiling Even though it Matches in VS.NET 2005

I changed a reference in my project from pointing to a specific hard-coded DLL to a project reference and now I'm getting an error telling me that the signature for some event handlers don't match even though they do. Here's one exact message: Method 'Private Sub ObjectsGrid_CellChange(sender As Object, e As Infragistics.Win.UltraWinGr...

What should my AST look like for easy transforms?

I have a minimal toy language similar to javascript. I generate an AST to try out some optimization techniques like escape analysis, type inference. I tried a few approaches like generalizing operator tokens instead of a class/function for each one, keeping type information on every node... But I still don't feel like I am going anywhere...

Managing C++ objects in a buffer, considering the alignment and memory layout assumptions

I am storing objects in a buffer. Now I know that I cannot make assumptions about the memory layout of the object. If I know the overall size of the object, is it acceptible to create a pointer to this memory and call functions on it? e.g. say I have the following class: [int,int,int,int,char,padding*3bytes,unsigned short int*] 1) ...

How do I get NAnt to use the new VB9 compiler for .NET 2.0 applications?

How do I tell NAnt to use the same VB compiler VS2008 uses when it creates .NET 2.0-targeting applications? I have switched a web application to VS2008 back-targetted to .NET 2.0. I can run NAnt (0.85rc4, 0.85, and 0.86b1) just fine once I do this. When I try to use some of the VB9 syntax, that still compiles just fine back to a .NET 2....

What make g++ include GLIBCXX_3.4.9?

I compiled 2 different binaries on the same GNU/Linux server using g++ version 4.2.3. The first one uses: GLIBC_2.0 GLIBC_2.2 GLIBC_2.1 GLIBCXX_3.4 GLIBC_2.1.3 The second one uses: GLIBC_2.0 GLIBC_2.2 GLIBC_2.1 GLIBCXX_3.4.9 GLIBCXX_3.4 GLIBC_2.1.3 Why the second binary uses GLIBCXX_3.4.9 that is only available on libstdc++.so.6.0...

Is anyone programming in Oberon?

I am interested to know if anyone is currently (or indeed, previously) is programming in the language Oberon (or its variants, Oberon 1, Oberon 2, Oberon 2007, or any other language derived from and largely compatible with Oberon) If so, what tools do you use? Do you have any self-written tools, or customisations such as syntax highligh...