compiler

Adding Scripting functionality to .NET applications

I have a little game written in C#. It uses a database as back-end. It's a Trading Card Game, and I wanted to implement the function of the cards as Script. What I mean is that I essentially have an Interface ICard which the Card implements (public class Card056 : ICard) and which contains function that are called by the game. Now, to...

Learning to write a compiler

Preferred Languages : C/C++, Java, and Ruby I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby so I prefer resources that involve one of those three, but any good resource is acceptable. ...

CSharpCodeProvider Compilation Performance

Is CompileAssemblyFromDom faster than CompileAssemblyFromSource? It should be as it presumably bypasses the compiler front-end....

C# logic order and compiler behavior

In C#, (and feel free to answer for other languages), what order does the runtime evaluate a logic statement? Example: DataTable myDt = new DataTable(); if (myDt != null && myDt.Rows.Count > 0) { //do some stuff with myDt } Which statement does the runtime evaluate first - myDt != null or: myDt.Rows.Count > 0 ? Is there a...

Invalid Resource File

When attempting to compile my C# project, I get the following error: 'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file. Having gone through many Google searches, I have determined that this is usually caused by a 256x256 image inside an icon used by t...

Code crash in MS Visual Studio 2005 in RELEASE configuration

Hi, I have a workspace for running an H.263 Video Encoder in a loop for 31 times i.e. the main is executed 31 times to generate 31 different encoded bit streams. This MS Visual Studio 2005 Workspace has all C source files. When i create a "DEBUG" configuration for the workspace and build and execute it, it runs fine, i.e. it generates a...

What are the best resources on designing a new language?

I've been toying with the idea of building a new general purpose programming language lately, and I was wondering where to go for help. Does anyone have a favorite book? Tutorial? Tools? I see the primary benefit of the project being that I will learn more about language design. I have little hope that it will become the next Ruby o...

Checking for string contents? string Length Vs Empty String

Which is more efficient for the compiler and the best practice for checking whether a string is blank? Checking whether the length of the string == 0 Checking whether the string is empty (strVar == "") Also, does the answer depend on language? ...

Bootstrapping a language

I've heard of the idea of bootstrapping a language, that is, writing a compiler/interpreter for the language in itself. I was wondering how this could be accomplished and looked around a bit, and saw someone say that it could only be done by either writing an initial compiler in a different language. handcoding an initial compiler in ...

Mixed C++/CLI TypeLoadException Internal limitation: too many fields.

On a quest to migrate some new UI into Managed/C# land, I have recently turned on Common Language Runtime Support (/clr) on a large legacy project, which uses MFC in a Shared DLL and relies on about a dozen other projects within our overall solution. This project is the core of our application, and would drive any managed UI code that is...

Warning: Found conflicts between different versions of the same dependent assembly

I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem). The problem is that if I include an external component I always get the following warning: "Found conflicts between different versions of the same ...

What's a 'null defined macro'?

I'm learning objective-C and Cocoa. In the Apple tutorial I'm working through there's a side note that says: IBOutlet is a null-defined macro, which the C preprocessor removes at compile time. I'm curious - what's a null-defined macro? Cheers Ben ...

C on Visual Studio

I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either: learn the ins and out of C in Visual Studio recommend a better C IDE + compiler...

.NET Compiler -- DEBUG vs. RELEASE

For years I have been using the DEBUG compiler constant in VB.NET to write messages to the console. I've also been using System.Diagnostics.Debug.Write in similar fashion. It was always my understanding that when RELEASE was used as the build option, that all of these statements were left out by the compiler, freeing your production co...

How to remove debug statements from production code in Java

Is it possible for the compiler to remove statements used for debugging purposes (such as logging) from production code? The debug statements would need to be marked somehow, maybe using annotations. It's easy to set a property (debug = true) and check it at each debug statement, but this can reduce performance. It would be nice if the ...

Which 4.x version of gcc should one use?

The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are however very scared of c-compiler bugs (for a good reason hi...

Compiler Error C2143 when using a struct

I'm compiling a simple .c in visual c++ with Compile as C Code (/TC) and i get this compiler error error C2143: syntax error : missing ';' before 'type' on a line that calls for a simple struct struct foo test; same goes for using the typedef of the struct. error C2275: 'FOO' : illegal use of this type as an expression ...

Learning Resources on Parsers, Interpreters, and Compilers

I've been wanting to play around with writing my own language for a while now (ostensibly for the learning experience) and as such need to be relatively grounded in the construction of Parsers, Interpreters, and Compilers. So: Does anyone know of any good resources on constructing Parsers, Interpreters, and Compilers? EDIT: I'm not l...

function declaration isn't a prototype

I have a library I created, mylib.c: #include <mylib.h> int testlib() { printf("Hello world\n"); return (0); } mylib.h: #include <stdio.h> extern int testlib(); In my program, I've attempted to call this library function: myprogram.c: #include <mylib.h> int main (int argc, char *argv[]) { testlib(); return (0); ...

C++ Compiler Error C2371 - Redefinition of WCHAR

I am getting C++ Compiler error C2371 when I include a header file that itself includes odbcss.h. My project is set to MBCS. C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\odbcss.h(430) : error C2371: 'WCHAR' : redefinition; different basic types 1> C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(289) : see d...