compiler

What settings affect the layout of compiled java .class files? How can you tell if two compiled classes are equal?

I have an app that was compiled with the built-in Eclipse "Compile" task. Then I decided to move the build procedure into Ant's javac, and the result ended being smaller files. Later I discovered that adjusting the debuglevel to "vars,lines,source" I could embed the same debug information that Eclipse did, and in a lot of cases files st...

C++ - Constructor overloading - private and public

Hi All, Can you tell me why the following code is giving me the following error - call of overloaded "C(int)" is ambiguous I would think that since C(char x) is private, only the C(float) ctor is visible from outside and that should be called by converting int to float. But that's not the case. class C { C(char x) { } p...

Have you ever effectively used lexer/parser in real world application?

Recently, I am started learning Antlr. And knew that lexer/parser together could be used in construction of programming languages. Other than DSL & programming languages, Have you ever directly or in-directly used lexer/parser tools (and knowledge) to solve real world problem? is it possible to solve the same problem by an average progr...

compiler construction vs functional programming, which is tougher to learn?

Some background about me, I work for a financial organsation, in a support job. Where we work 10-11 hrs a day in supporting applications, which doesn't require any new additional skill. But my work also demands me to spend 6-10 hrs of java (servlet/jsp) coding per week. But after 9 yrs of experience, I feel passionate about programming ...

Good IDE/compiler for simple C dll's.

I'm trying to disassemble a C/C++ DLL, and have made some progress, but I would like to create my own C DLL with the same function the original exports, and compare disassemblies. Visual Studio adds to much crap, and when I remove the crap and build my project, the expected DLL is missing. I need a lightweight, preferably IDE, tool to ...

Why does g++ compile this?

Recently, after being very tired, I wrote the following code: GLfloat* array = new GLfloat(x * y * z); Which, of course should have been: GLfloat* array = new GLfloat[x * y * z]; (Note the square brackets as opposed to the parenthesis.) As far as I know, the first form is not valid, but g++ compiled it. Sure, it spat out a complet...

What are relaxed exceptions in .NET / C#?

I found the CompilationRelaxations attribute on an assembly when looking at it in Reflector. This link says that the attribute specifies whether: Optimizers are granted additional latitude for relaxed exceptions. What are relaxed exceptions and what does the compiler do given its "additional latitude" with them. ...

At what level C# compiler or JIT optimize the application code?

I want to know this info to reduce my code size so I will not waste my time optimize things that will be done by compiler or JIT. for example: if we assume the compiler inline the call to the get function of a property so I do not have to save the return value in a local variable to avoid function call. I want to recommend a good ref...

How internally this works int const iVal = 5; (int&)iVal = 10;

I wanted to know how the following works @ compiler level. int const iVal = 5; (int&)iVal = 10; A bit of m/c or compiler level answer would be great full. Thanks in advance. ...

UNIX symbol referencing error

Greetings Everyone. I'm currently trying to compile a multiple-language program (C, C++ and FORTRAN) using GNU compilers in UNIX (g++, gcc & f77 respectively). All my sources are compiling into objects with no errors however I encounter a symbol referencing error as they are linked as shown below: f77 -L/usr/sfw/lib -R/usr/sfw/lib -lg...

Why do I get the "unrecognised emulation mode: 32" error in Eclipse?

How come I get this error when compiling with the -m32 argument? unrecognised emulation mode: 32 I'm compiling using g++ on an x86_64 machine. It happens in one project, but not the other... Any hints? Note: I'm using Eclipse CDT, so perhaps this is an IDE specific gocha? Rephrased question Perhaps a better question would be: Wh...

How to tell compiler to NOT optimize certain code away?

Is there a way to tell the compiler (g++ in my case) to not optimize certain code away, even if that code is not reachable? I just want those symbols in the object file. Example: Here is a simple function, and I do want this function to be compiled, even if it's never called. void foo(){ Foo<int> v; } If there is no official compil...

Need a Backend Compiler

I have created a compiler that produces an intermediate code. I do not have the time to write the backend for my project. Is there any software I could use to evaluate the intermediate code produced? Where could I download this software? The output looks something like this : t1 = 0.67596e-7 sum = t1 t1 = 2 t2 = 3 ...

Deprecate other methods/types

To prevent using some members (or type) there is a way to mark them as obsolete (and sometimes in the future remove them completly). But is there a way to deprecate members (or types) of the compiled third-party assemblies? Or, at least, to make sure (or to issue a warning) when they are used? ...

Fastcall GCC example

Could some one provide an example use of fastcall for use with gcc? If possible could you provide the equivalent call without using fastcall and explain how they would be different? ...

what is "stack alignment"?

What is stack alignment? Why is it used? Can it be controlled by compiler settings? The details of this question are taken from a problem faced when trying to use ffmpeg libraries with msvc, however what I'm really interested in is an explanation of what is "stack alignment". The Details: When runnig my msvc complied program which ...

How can I parse code to build a compiler in Java?

Hey, I need to write a compiler. It's homework at the univ. The teacher told us that we can use any API we want to do the parsing of the code, as long as it is a good one. That way we can focus more on the JVM we will generate. So yes, I'll write a compiler in Java to generate Java. Do you know any good API for this? Should I use reg...

What is the best tool for creating a Java extension?

Our project group is working on a Java language extension and we have been trying to figure out what tool we should use for this purpose. The extension will primarily consist of a modification of the concurrency model used in Java. We have been looking at two tools so far: Polyglot and Javacc. Javacc seems to be a bit more easy to use, b...

What does casting do at compiler/machine level?

I have often wondered what exactly does casting do at compiler or machine level. What does it do with the 0 and 1s in memory? Can anyone point me at some good literature. ...

Can someone explain this linker difference between g++ 3.4.2 and g++ 4.1.2?

I just moved some code from one platform to another which required a change in compiler versions. Two of the utility sources caused linking problems with undefined symbols, for this example call them Foo.c and Foo.h. Everything was compiling and linking fine with g++ 3.4.2 and I figured the switch to g++ 4.1.2 would be a no brainer. W...