compiler

How to generate a compiler error based on an attribute being missing in C#?

I create a number of add-ins for the Revit Structure API. Each tool has to habe a class which implements the interface IExternalCommand. In the latest version of Revit, for your tool to work you need to have two attributes on the class that implements that interface: [Regeneration(RegenerationOption.Manual)] [Transaction(TransactionMo...

What exactly happens when i perform cast on reference types and value types

What exactly happens when i perform casting on reference types and values types and vice versa (boxing and un boxing) at the compiler or runtime level? Can any body explain for the below four conditions ?Please feel free to add conditions ,if i miss any. 1. Stream stream = new MemoryStream(); MemoryStream memoryStream = ...

How is parsing phase in a compiler different from a rule engine ?

Hi, I have a rough understanding of how the compilers work (I mean languages, grammars, lexical analysis, parsing etc). The rule engines have various rules and associated action, just like you have rules in the grammars and you can associate actions with them in parser-generator tools like ANTLR. So I am a bit confused on how to diffe...

Why is undefined behavior allowed (as opposed to not compiling/crashing)?

I understand the reasons for compiler/interpreter language extensions but why is behaviour that has no valid definition allowed to fail silently/do weird things rather then throwing a compiler error? Is it because of the extra difficulty(impossible or simply time consuming) for the compiler to catch them)? P.S. what languages have undef...

What is the .NET attribute to not compile a method is release mode

I know that if I have a block of code I don't want compiled when in release mode I can wrap that code block in: #if DEBUG while(true) { Console.WriteLine("StackOverflow rules"); } #endif This will keep this code block from compiling in any mode other than DEBUG. I know there is an attribute that can be placed on an entire method t...

How do I determine which C/C++ compiler to use?

Greetings, I am trying to figure out which C/C++ compiler to use. I found this list of C/C++ compilers at Wikipedia: http://en.wikipedia.org/wiki/List_of_compilers#C.2FC.2B.2B_compilers I am fairly certain that I want to go with an open source compiler. I feel that if it is open source then it will be a more complete compiler since ma...

What are the limitations of Reflection.Emit vs. other assembly generation techniques?

I've used Reflection.Emit in the past to write a compiler, but I know the standard compilers don't use it, and in an answer to another question here I saw a mention that there are some things Reflection.Emit is unable to do. What are the limitations of Reflection.Emit that I should be aware of if I plan on writing another compiler for ....

How to Compile Flash .fla into .swf via command line?

How to compile Flash .fla files into .swf via command line on a Windows based operating system. Command line tools that need to be installed are ok. Can anyone suggest me what to do? (in a straight forward way). :-) Thanks. ...

C2360 compiler error on TFS build, but not on desktop

A c++/cli code snippet similar to the code below caused our TFS build to fail with a C2360 compiler error. switch (i) { case 0 : for each (int n in a) System::Console::WriteLine(n.ToString()); break; case 1 : System::Console::WriteLine("n is not in scope here"); break; } This is fixed by...

What is the state of C99 support in major compilers / toolchains?

A response to a comment I made here made me stop and think: "I don't really know what the state of C99 support is." Wikipedia gives details for a few compilers, but I'm not familiar enough with C99 to know all the bits and pieces of the standard, so I'm looking for a gestalt overview answer to the question: What is the state of C99 sup...

Compiling NyARToolKit on iPhone 3.0

Hi, Has anyone here succeeded in getting NyARToolKit to run on iPhone 3.0? I'm fighting with this but I am at least down to a couple of errors: Duplicate symbol _spriteVertices (referring to the 3DGraphicsView & NyARToolKitCrossCompileAppDelegate). glView.delegate = self; (error in NyARToolKitCrossCompileAppDelegate.m) Any suggestio...

Make errors - can the gcc compiler warnings prevent a C file from being compiled into an object file?

I'm trying to compile a wireless network card driver for my Linux box and I ran into a problem with the Make command. During the compilation process I normally see warnings on some of the C files that being are compiled; despite the warnings these files were still able to be compiled to an object file. When the Make process comes to a f...

How I can Integrate my Compiler in VS2008?

I make a compiler of Tiger and I want integrate with VS2008, but I read a lot of stuff and don't say very well how I can made that. What is the type of the project that I need to make? How I register my Language/compiler in VS2008, I know that I need install the SDK, I know little thing that I need to do but the steps more important, lik...

C# 'is' type check on struct - odd .NET 4.0 x86 optimization behavior

Update: I have filed a bug report with Microsoft Connect, please vote for it! Update 2: Microsoft have marked the bug report as fixed Posted by Microsoft on 18/08/2010 at 17:25 This bug will be fixed in a future version of the runtime. I'm afraid it's too early to tell if that will be in a service pack or the next major...

Can I make the compiler and the CLR ignore non implemented interfaces on my types?

I would like to define a type implementing a certain interface, however I would only implement it in a proxy at runtime. I can see two obstacles in this scenario : 1-Make the compiler ignore non implemented interfaces. 2-Make the CLR ignore(or at least delay) the TypeLoadException with the following description : "Method SOMEMETHOD in t...

'Lexical' scoping of type parameters in C#

I have 2 scenarios. This fails: class F<X> { public X X { get; set; } } error CS0102: The type 'F<X>' already contains a definition for 'X' This works: class F<X> { class G { public X X { get; set; } } } The only logical explanation is that in the second snippet the type parameter X is out of scope, which is not true...

build notification in visual Studio 2008\2010 - WMI etc

I want to be notified when a build has been completed\failed in visual studio and I DO NOT want to use pre\post build steps, I want an external process or VS plugin that will count the number of builds. So is there anyway to achieve this using something like WMI or other such technology? I'm not interested in third party libaries, I wa...

What does it mean for a language to be ‘interpreted’?

Hi! A newbie question. Do languages like e.g. Ruby (if running MRI, I mean not compiled to byte-code) run actually parsed everytime when an execution of, e.g., method or loop body is needed? I mean, to execute a loop, you need to parse its body N times? I just always thought that all these programs are being parsed one time at the boot...

Dynamically generating high performance functions in clojure

I'm trying to use Clojure to dynamically generate functions that can be applied to large volumes of data - i.e. a requirement is that the functions be compiled to bytecode in order to execute fast, but their specification is not known until run time. e.g. suppose I specify functions with a simple DSL like: (def my-spec [:add [:multiply...

How a JIT compiler helps performance of applications?

I just read that Android has a 450% performance improvement because it added a JIT compiler, I know what JIT is, but I don't really understand why is it faster than normal compiled code? or what's the difference with the older approach from the Android platform (the Java like run compiled bytecode). Thanks! EDIT: This is hugely interes...