compiler

Simple read vs write boolean variable performance comparison question

What should be the preferred way by programmers: 1) Only Write: SomeBoolean = True 2) Read but write only if necessary If Not SomeBoolean Then SomeBoolean = True ...

C: warns about implicit long to int conversion

Hi, I was wondering whether there is a way to tell the compiler (I'm on gcc version 4.1.2 20080704 (Red Hat 4.1.2-46) or icc 11.1) to throw a warning whenever a long-to-int implicit conversion takes place. For example, compiling the file test.c which contains the code: #include <stdio.h> #include <stdlib.h> int main(int argc, char** a...

Is compiler allowed to ignore inline in case of template specialization?

Hello everybody. Lets say you have simple template function (not class member for the sake of simplicity) with type specific specialization in the same .h file... template <class TYPE> void some_function(TYPE& val) { // some generic implementation } template <> inline void some_function<int>(int& val) { // some int specific ...

How to use the -MG flag in cc 4.4.1?

I've recently upgraded my Ubuntu installation from Jaunty to Karmic. This apparently includes an update of the GNU C compiler, because code that compiled previously no longer does. Running cc 4.4.1 (Ubuntu 4.4.1-4ubuntu8) now produces the following error, on code that worked fine in the cc 4.3.3 (Ubuntu 4.3.3-5ubuntu4): $ make cc -c -M...

Is there a Java program snippet which can compile at Java level 5 but not level 6?

I want to have a source file which can compile with javac / ecj set to Java 5 but not Java 6 (even if the underlying Java runtime is Java 6). This is to be certain that the compiler level is set correctly in Eclipse 3.5 running with Java 6 installed, but where the result needs to run on a Java 5 installation. For java 1.4 I could use "...

how to implement objects for toy language ?

I am trying to make a toy language in c++. I have used boost spirit for the grammar, and hopefully for parser/lexer. The idea is a toy language where 'everything is an object' like javascript and some implementation of prototype based inheritance. I want to know how to implement the 'object' type for the language in c++. I saw source cod...

Binary compatibility between Linux distributions

Sorry if this is an obvious question, but I've found surprisingly few references on the web ... I'm working with an API written in C by one of our business partners and supplied to us as a .so binary file, built on Fedora 11. We've been testing out the API on a Fedora 11 development machine with no problems. However, when I try to li...

IL Compiler for .NET?

This may be a dumb question, but is there a compiler for IL code, similar to that shown by Reflector in IL mode? ...

Where do I learn "what I need to know" about C++ compilers?

I'm just starting to explore C++, so forgive the newbiness of this question. I also beg your indulgence on how open ended this question is. I think it could be broken down, but I think that this information belongs in the same place. (FYI -- I am working predominantly with the QT SDK and mingw32-make right now and I seem to have confi...

Seriously speeding up PHP?

I've been writing PHP for years, and have used every framework under the sun, but one thing has always bugged me... and that's that the whole bloody thing has to be interpreted and executed every time someone tells my server they want the page served. I've experimented with caching, FastCGI, the Zend Job Queue (and symfony plug-ins that...

C++ program problem

I am new to C++ programming. So I was trying my luck executing some small programs. I am working on HP-UX which has a compiler whose executable is named aCC. I am trying to execute a small program #include <iostream.h> using namespace std; class myclass { public: int i, j, k; }; int main() { myclass a, b; a.i = 100; ...

G++ Compilers for MonoDevelop

How do you setup a G++ compiler for MonoDevelop? On both OS X and Windows Vista the default install complains about "Compiler Not Found: g++". Is MonoDevelop not a good cross platform IDE for C++ development (since it is a C#/Java IDE). Thanks SO! ...

what's wrong with my makefile?

I have this project that that I compile with the following command: g++ ALE.cpp -lncurses This gives me a.out file. I have the following Makefile but it seems to not be edited correctly. HEADERS = LinkedListNode.h LinkedList.h Classes.h GUI.h Functions.h default: ale ale.o: ALE.cpp $(HEADERS) g++ -c ALE.cpp -o ale.o -lncurses ...

How many GCC optimization levels are there?

How many GCC optimization levels are there? I tried gcc -O1, gcc -O2, gcc -O3, and gcc -O4 If I use a really large number, it won't work. However, I have tried gcc -O100 and it compiled. How many optimization levels are there? ...

How to get gcc -O1 optimization without specifying -O1

I know that -O1 automatically turns on certain flags. These flags can be turned on manually though. If I don't specify -O1, it should still be possible to get -O1 optimization by specifying all the flags that -O1 turns on. I tried -fthread-jumps -fcprop-registers -fguess-branch-probability but it still does not do -O1 optimization....

How to turn off specific optimization flags in gcc

I want to compile with optimization -O1, but there is a certain flag that it turns on that I do not want to use. How do I turn it off? ...

Stack allocation limit for programs on a Linux 32 bit machine

In C++ how much can the stack segment grow before the compiler gives up and says that it cannot allocate more memory for stack. Using gcc on a linux (fedora) 32 bit machine. ...

compiler optimization implementation

I just have to implement optimizing techniques on a compiler... can you please tell me a tool to convert high level language code to three adress code.... so I can implement some technique on 3 adress code..by making a program on Java or any other language I don't want to make compiler..just want to show the techniques working ...

How does C++ handle multiple source files?

I'm studying C++ right now, coming from a background in Python, and I'm having some trouble understanding how C++ handles multiple source files. In Python, the import statement first checks the current working directory for the module you're trying to import and then it checks the directories in sys.path. In C++, where would I place a cu...

Is there a g++ equivalent to Visual Studio's __declspec(novtable)?

Is there a g++ equivalent to Visual Studio's __declspec(novtable) argument? Basically, in a pure virtual base class the __declspec(novtable) argument can be used to suppress the creation of a vtable for the base class as well as vtable initialization/deinitialization code in the contstructor/destructor respectively. E.g., class __decl...