compiler

Update GCC on OSX

So I am a new programmer and I just installed XCode on my Macbook to get the GCC. I think Xcode is the only way for getting GCC on OSX. Now when I run my Hello World application, in C++, g++ comes up saying it is version 4.0.1 but when I look for commands starting with g I also see g++-4.2. Is there any way of making 4.2 default rather t...

Should I study Operating Systems or Compilers?

I have a compiler book, Compilers, and an operating systems book, Operating System Concepts. I have read some of both and, eventually, I plan on completing both. However, for right now, I would like to pick one of them to focus on. I want to read something that will help me develop some good practical skills, via exercises, small project...

Replicating C struct padding in Java

Hi, According to here, the C compiler will pad out values when writing a structure to a binary file. As the example in the link says, when writing a struct like this: struct { char c; int i; } a; to a binary file, the compiler will usually leave an unnamed, unused hole between the char and int fields, to ensure that the int field i...

Stratego/XT Programming Language

Does anyone know something about Stratego/XT Programming Language? What is it good for? Any good and/or bad experiences with it? Any real live running example? Thanks a lot. ...

How much should I worry about the Intel C++ compiler emitting suboptimal code for AMD ?

We've always been an Intel shop. All the developers use Intel machines, recommended platform for end users is Intel, and if end users want to run on AMD it's their lookout. Maybe the test department had an AMD machine somewhere to check we didn't ship anything completely broken, but that was about it. Up until a few of years ago we ju...

How does c++ by-ref argument passing is compiled in assembly?

In the late years of college, I had a course on Compilers. We created a compiler for a subset of C. I have always wondered how a pass-by-ref function call is compiled into assembly in C++. For what I remember, a pass-by-val function call follows the following procedure: Store the address of the PP Push the arguments onto the stack Per...

Using Flash Runtime as Platform (similar to JVM / CLR)

Does anyone know whether any compilers exist to produce programs that will run on the Flash runtime from source code other than Flex? i.e. similar to how Groovy, Scala, etc compilers generate bytecode for the JVM. ...

Programmatically generate a C Win32 DLL.

I need to repeatedly generate a Win32 DLL with a registration information function. This function uses literals to return customer specific registration information, with a separate DLL being built per customer. I have a test version working correctly, with hard-coded information for one customer. The urgency for some sites dictates I...

Why does the Flex compiler generate varying file sizes on successive compilations of the exact same source code?

I'm building a SWF using the command line compiler mxmlc.exe. The compiler writes the output file size as part of it's stdout. If I run the compiler multiple times in succession without changing the actual source code, I see the file size bounce up and down a few bytes at a time. C:\>mxmlc.exe Gallery.as C:\Gallery.swf (28443 bytes) ...

Do programming language compilers first translate to assembly or directly to machine code?

I'm primarily interested in popular and widely used compilers, such as gcc. But if things are done differently with different compilers, I'd like to know that, too. Taking gcc as an example, does it compile a short program written in C directly to machine code, or does it first translate it to human-readable assembly, and only then uses...

Why is the C# compiler emitting a callvirt instruction for a GetType() method call?

I am curious to know why this is happening. Please read the code example below and the corresponding IL that was emitted in comments below each section: using System; class Program { static void Main() { Object o = new Object(); o.GetType(); // L_0001: newobj instance void [mscorlib]System.Object::.ctor() ...

Runtime vs Compile time

Can anyone please give me a good understanding of whats the difference between run-time and compile-time? ...

zero Functor construction and overhead even with new and delete?

If I have a functor class with no state, but I create it from the heap with new, are typical compilers smart enough to optimize away the creation overhead entirely? This question has come up when making a bunch of stateless functors. If they're allocated on the stack, does their 0 state class body mean that the stack really isn't change...

Multiply defined symbols

Hi, If I declare a global variable in a header file and include it in two .cpp files, the linker gives an error saying the symbol is multiply defined. My question is, why does this happen for only certain types of object (eg. int) and not others (eg. enum)? The test code I used is given below: test.h #ifndef TEST_HEADER #define TEST_H...

Visual studio, how to output time taken to build?

Hi, I'm using visual studio 2005. I rememeber in the back of my mind there's a way to output the time taken to build a given project. Can anyone remember what that switch is? Thanks Rich ...

How do I create a Win32 DLL without MSVCR90D.dll?

I am trying to recreate an existing C Win32 DLL with a single, simple function. I have managed to do this using VS C++ 2008 Express, and my new DLL works on my Vista dev machine, and on the client's XP machine. However, it doesn't work on other sites. I have checked dependencies and my DLL requires MSVCR90D.dll and KERNEL32.dll, where...

Is it Better to Design a Language that Utilizes White Space Instead of Symbols to Group Code?

I have found myself designing a language for fun that is a cross between Ruby and Java, and as I work on the compiler / interpreter I find myself pondering using whitespace as a terminator, like: class myClass extends baseClass function someFunction(arg) value eq firstValue value2 eq anotherValue x = 2 The alter...

How to Compile a C# Project from Source

So I mean compile without visual studio ...

Official Java compiler

Hello, I googled,I checked wikipedia.None of them helped me to find an official java compiler by Sun. By "official" I mean for example "C# Express" by Microsoft.I want that type of compiler by Sun. My question is: Where do I get it? I'm very sorry for my stupid question,I just get lost when I open java dot com. Thanks in advance for...

Oracle compile view sql

As part of our ANT based deploys we run some sql against an Oracle database. The deploys are set to fail if any sql errors occur. (We do this using WHENEVER SQLERROR EXIT FAILURE ROLLBACK in our SQL files and using the ant exec command with failonerror=true to run the sql). We would like to add to our deploy sql files some sql that ...