compiler

What are all the member-functions created by compiler for a class? Does that happen all the time?

What are all the member-functions created by compiler for a class? Does that happen all the time? like destructor. My concern is whether it is created for all the classes, and why is default constructor needed? ...

C string literal storage between multiple copies of process or library

What is the behavior of various systems when you have more than one copy of a particular program or library running, do string literals get stored once in RAM or once for every copy of the process/library? What if they are stored in an array like: static const char *const foo[] = { "bar", "baz", "buz" }; Does the static change the beh...

Meta-relationships on language-oriented programming.

In the process of developing a new language. How can be related the "high level" concepts such as "LALR parser", "abstract syntax tree", "context-free grammars", etc. with other "low level" concepts like the specific grammar rules "A -> B". I mean as some kind of metalanguage relationship, or similar. Any ideas or suggestions to look m...

iPhone GCC / LLVM GCC or LLVM?

Im asking the experts here... Does anybody have made some performance test about which compiler is the best for iPhone apps? Since we have the choice between: GCC 4.2 LLVM GCC 4.2 LLVM compiler 1.5 Im wondering which of the 3 offers the best performance... I've done some quick test myself but haven't found much difference? Which ...

A way to read data out of a file at compile time to put it somewhere in application image files to initialize an array.

considering visual C++ compiler, Lets say I've got a file with whatever extension and it contains 100 bytes of data which are exactly the data that I want to initialize an array of char data type with a length of 100 characters with, Now apparently one way is to read those data out of file by using I/O file classes or APIs at run-time bu...

GCC vs MS C++ Compiler

I often read that the GCC compiler is much better than the Microsoft compiler on various forums and comment thread. This is always because "Micro$oft is evil" and that GCC is open-source. Are there any technical reasons that GCC is better? Are there any scenarios where one would want to use GCC over MS for windows development? Are there ...

volatile + object combination disallowed in C++?

I'm using an embedded compiler for the TI TMS320F28335, so I'm not sure if this is a general C++ problem (don't have a C++ compiler running on hand) or just my compiler. Putting the following code snippet in my code gives me a compile error: "build\main.cpp", line 61: error #317: the object has cv-qualifiers that are not compatible wit...

really funky C# compiler behavior with nullable literals

The C# 4.0 compiler does not complain about this (not even a warning): if(10.0 > null + 1) { } if (myDoubleValue > null) { } And it seems to be always false. What is going on here? Is null automatically converted to Nullable<double> or something? If so why doesn't this work then: double myDoubleValue = null + 1; Also, why ...

Linking phase in distcc

Is there any particular reason that the linking phase when building a project with distcc is done locally rather than sent off to other computers to be done like compiling is? Reading the distcc whitepages didn't give a clear answer but I'm guessing that the time spent linking object files is not very significant compared to compilation....

Why would C# allow an invalid enum value

I've spent a while trying to understand why my WPF app wasn't databinding to an enum property propertly and this is the cause. static void Main(string[] args) { MyEnum x = 0; Console.WriteLine(x.ToString()); Console.ReadLine(); } public enum MyEnum { First = 1, Second = 2 } Essentially the problem was that there was n...

Is there any compiler simulator for mobile phones?

I was wondering if there exists an application for mobile phones(any platform) that simulates compiler, validates syntax? It would be nice to have one the phone:) Particularly I am looking something for C# or C++(like gcc). It does not have to generate any output code, just the front-end part(lexilal, syntax analysis...) ...

how to read the header block gcc compiler put to .o .a and an executable

I'd like to read the header block gcc put to the beginning of all .o .a and executables. In those days, on Solaris, there was an utility for this purpose. On linux, is similar utility available? ...

Purpose of C/C++ Prototypes

I was reading wikipedia on C/C++ Prototype statements and I'm confused: Wikipedia say: "By including the function prototype, you inform the compiler that the function "fac" takes one integer argument and you enable the compiler to catch these kinds of errors." and uses the below as an example: #include <stdio.h> /* * If this prot...

Static Type Constraints without Inline?

Recently there have been a couple questions regarding static type constraints and inline: http://stackoverflow.com/questions/3754862/use-of-inline-in-f http://stackoverflow.com/questions/3757126/how-does-f-compile-functions-that-can-take-multiple-different-parameter-types-in Two statements in particular have struck me: "There is no...

Access output from java compiler in C#

I'm writing a program in C# that will compile java files using the java compiler (javac). I am having trouble capturing the output from javac (a command-line tool) to tell the user of errors. I know how to start a process and capture the standard output, but javac returns nothing. Is there any other way that I can capture the output, or ...

Java Compiler Callback Mechanism?

Is there any type of callback mechanism within the Java compiler? I'd like to be a able to register a listener to act when certain tokens are found within the source. Annotations let you do this, but unfortunately this won't work for what I am trying to do. ...

Compiler Optimization with Parameters

Lets say you have some functions in some classes are called together like this myclass::render(int offset_x, int offset_y) { otherClass.render(offset_x, offset_y) } This pattern will repeat for a while possibly through 10+ classes, so my question is: Are modern C++ compilers smart enough to recognise that wherever the program sto...

Using adaptive grammars

Hi, I'm trying to implement a language (or family of languages) whose grammar can be changed dynamically. I have found no examples that serve as study cases. Can you give me some reference to any that are actually used in the real world (even from the academic world)? Does it make sense to implement a Domain-Specific Languages with a ...

How can I see in what [Java/Scala?] code does Scala compiler rewrites original Scala-code

Following Scala mailing lists, different people often say: "compiler rewrites this [scala] code into this [java/scala??] code". For example, from one of the latest threads, if Scala sees class C(i: Int = 4) { ... } then the compiler rewrites this as (effectively): class C(i: Int) { ... } object C { def init$default$1: Int = 4 } H...

How-to ensure that compiler optimizations don't introduce a security risk ?

I have to write a Windows service that handles at some point confidential data (such as PIN codes, passwords, and so on). Those informations are needed for a very short amount of time: usually they are sent almost immediately to a smart card reader. Lets consider this piece of code: { std::string password = getPassword(); // Get the ...