compiler

Making MSVC compiler GCC complient?

Is there a way to make the msvc compiler as strict as gcc? MSVC lets me do some pretty crazy things that result in hundreds of errors when I compile in linux. Thanks ...

How do I tell the C# compiler not to optimize away an unused class?

When I compile a project with release build and code optimization types that are not referenced anywhere in code are no longer included in the assembly. The problem is that I want to use these types by reflection at runtime. Is there an attribute, or some other way that I can tell the compiler not to optimize away a given class? ...

How is compiling c++/c#/java different?

Hi, I'm trying to understand how these languages work under the hood. Unfortunately I only ever read very superficial things. I'll summarize what I know already, I would be really happy if you could correct me, and most of all, help me enhance my little bits of half-knowledge. C++: The C++ compiler preprocesses all source files. This ...

Why does the C# compiler insert an explicit interface implementation?

I ran into a strange C# edge case and am looking for a good work-around. There is a class that I do not control that looks like this: namespace OtherCompany { public class ClassIDoNotControl { public void SomeMethod(string argument) { Console.WriteLine((new StackFrame(1).GetMethod().Name)); }...

How to ‘partly compile’ Java in Eclipse?

My Eclipse is configured 'Project'->'Build Automatically'. There are large number of Java files in my project. Once one java file is modified, all java files are compiled under the project. It spends much time really. My question is how to configure Eclipse as 'partly compile' which merely compiles related java files. Does it make sense...

How to find out what optimizations the JVM applied to my code?

The JVM (especially the HotSpot VM) is famous for having a huge number of optimizations it can apply at runtime. Is there a way to look at a certain piece of code and see what the JVM has actually done to it? ...

Is there online php compiler that I can test with multiple php files ?

I am using codepad.org and ideone.com for sharing my php code with others and using jsfiddle.net to share my jquery code with others. Now I want to share a php script with others in which a form submission work is done. In my local machine I have two files. 1. myform.php(contain form) 2. _myform.php(action on form submission). How can I...

Parsing a code block with EBNF expression

Hello there, I am using CocoR to generate a java-like scanner/parser: I'm having some troubles in creating a EBNF expression to match a codeblock: I'm assuming a code block is surrounded by two well-known tokens: <& and &> example: public method(int a, int b) <& various code &> If I define a nonterminal symbol codeblock =...

Makefile variable substitution sometimes ignored

Compiling a CUDA enabled version of aircrack-ng that hasn't been bug-fixed in a while so needed a bit of patching to get most of the way there. Basically, the make cannot find the relevant compiler (nvcc) for this one section of code; Relevent Makefile section ifeq ($(CUDA), true) CFLAGS += -DCUDA_ENABLED NVCC := $(CUDA_BIN)/nvcc IN...

How to use the cl command?

Hi, all, I found a piece of information on how to call c files in python, in these examples: there is a c file, which includes many other header files, the very beginning of this c files is #include Python.h, then I found that #include Python.h actually involves many many other header files, such as pystate.h, object.h, etc, so I incl...

Delphi 6 Compiler Options (Pentium-safe FDIV)

I recieved a crash report from MadExcept from a user. The Exception was Invalid floating point operation. The odd part though is that the callstack dies at @FSafeDivide. I did a google and found out that this was a check for certain pentium chips which didn't do division correctly. If the test failed all the divisions would be done i...

Compiling/parsing meaningful whitespace

Hi I'm looking to make a pseudo Markdown kind of language and a parser to parse it into xhtml. I've never written a compiler... I've taken brief looks at ANTLR and am wondering if ANTLR can handle parsing things with meaningful whitespace? So say I have something like this: some text some other text # bullet point # nest...

Compile Time Code Generation in D

I'm currently learning D, and one of the things I've wondered about is whether D has a way of duplicating the code generation capabilities of JVM languages. Here's a scenario: I have an object, and I want to generate a string based on that object that gives it's name and all its fields. In Java/Scala, I could just use reflection, but su...

Conditional JIT-compilation

In Java we can do conditional compilation like so private static final boolean DO_CHECK = false; ... if (DO_CHECK) { // code here } The compiler will see that DO_CHECK is always false and remove the entire if-statement. However, sometimes, especially in library code, we can't use conditional compilation, but I'm wondering, can we...

Cannot refer to a instance method while explicitly invoking a constructor

Hi, Does anyone know why you can reference a static method in the first line of the constructor using this() or super() but not a non-static method? Consider the following working: public class TestWorking{ private A a = null; public TestWorking(A aParam){ this.a = aParam; } public TestWorking(B bParam) { ...

Why am I getting an "xxx is already defined" compiler error?

I am trying to create multiple threads using variable like threadname1, threadname2,..threadnamen. Instead of giving it as a hard coded value I am trying to do it using a for loop for the n numbers and use that at the end of "threadname" string. It throws some error. How do I fix this issue? public class RunnableExample{ public sta...

Is this statically bound?

Say that I have a C program and it has this line: int a = 12; Is the value of 12 bound to 'a' during compile time? Or is the value placed into memory during run time when the scope of the program hits 'a'? What about programming languages like Python and Ruby? Are there languages/instances where a value is statically bound to a vari...

Set default GCC to Fink-installed GCC 4.5?

I've got GCC 4.2 that came with my installation of Mac OS X 10.6.4, plus GCC 4.5 installed via Fink. I wanted to use gcc_select to change the default compiler to GCC 4.5, but was told gcc_select does not exist. Is there another way to set the default compiler? Or do I need to do so manually? If so, how? Thanks!! ...

C# newline constant error upon trying to compile

For some reason, when I'm trying to compile my .cs file into a .dll using the Visual Studio Command Prompt, I get a new line constant error upon trying to compile for some reason. It's not liking the semicolon after + feet". Any idea why? Here is my code: /* A simple C# class! */ public class Tree { public int height = 0; p...

Any reason why C#/VS doesn't have an auto-build feature like Java/Eclipse?

I am a C#/.Net developer who just began Java development for Android, and using Eclipse I noticed that it compiles as you go, so that at no point do you have to wait for the program to build. This seems pretty amazing, unless there is something going on I don't understand. I was wondering why C# and the Visual Studio IDE don't provide t...