compiler

Flex linking: Why is the size of my swf file smaller than the sum of it's swc's?

Here's a dumb question. I compile my Flex application with several swc's (libraries) and it creates a swf file. The sum of the swc's is roughly 4 MB yet the actual swf generated is only 1.6 MB. How is this possible? Thanks! ...

Compiler not flagging incorrect return value for HRESULT

I just spent way too long trying to diagnose why, in the following snippet of code, the ProcessEvent() method seemed to be ignoring the false value I passed in for aInvokeEventHandler: HRESULT CEventManager:: Process(Event anEvent) { return (m_pPool->GetFsm()->ProcessEvent(anEvent), false); } // Definition of ProcessEvent() HRESUL...

Interpret something, and run the generated bytecode in Java?

I'm writing a toy interpreter with a REPL in Java. I'd like to generate bytecode from the language and run that, instead of interpreting an AST and running that instead. Since my Java is a bit rusty, is it possible to run generated bytecode on the fly on the JVM? ...

Unable to understand a statement about compilers' optimization

I am interested in optimization at runtime by a VM and at compile-time. I have had the idea that optimizations are most efficient and easiest at compile-time. However, my thought seems to be false in certain circumstances. This is evident in Steve Yeggie's statement quoted by Daniel [O]ptimization is often easier when performed at r...

Using ML in "Real-World" Applications

I really liked learning ML at college. I find functional programming often a refreshingly elegant way to write certain algorithms. I have heard of F# and played around with that a bit. Still, I've written some interesting functions in ML and would like to integrate them as libraries I could use in other applications. Usually I paste ...

Unable to understand compilers' main optimizations

Martinus gives a good example of a code where compiler optimizes the code at run-time by calculating out multiplication: Martinus code int x = 0; for (int i = 0; i < 100 * 1000 * 1000 * 1000; ++i) { x += x + x + x + x + x; } System.out.println(x); His code after Constant Folding -compiler's optimization at compile-time (Thanks to...

Mac OS X free C compiler

Is there a small, free C or C++ compiler for OS X, like TCC? Xcode is not small, or simple like TCC, AFAIK. I'm looking for something like a GCC binary file or TCC for OS X. ...

How do polymorphic inline caches work with mutable types?

A polymorphic inline cache works by caching the actual method by the type of the object, in order to avoid the expensive lookup procedures (usually a hashtable lookup). How does one handle the type comparison if the type objects are mutable (i.e. the method might be monkey patched into something different at run time). The one idea I'v...

How to use Fortran compilers to parse-check or pretty print source files?

Is there a way to tell ifort or gfortran to just try to parse a source file (no include following, no compilation, no linking, etc) to tell us whether they find the syntax of the file acceptable / valid for a given Fortran version (77, 90, 95, ...) or at least valid at all? I'm working on a piece of software that will parse and analyze ...

Compiling Java code on the command line in Mac OS X

Really basic question I'm sure for some of you Java heads out there. I have a list of java files and jars that are required. On windows to build I have this batch file javac -cp .;opencsv-1.8.jar;mysql-connector.jar -source 1.4 -target 1.4 *.java jar cvf cup.jar *.class del *.class If I want to do the same thing on mac how would a ...

Unknown build error, 'Exception of type 'System.OutOfMemoryException' was thrown

We have VS.Net solution with 20 projects in it. Occasionaly, in VS.NET, when we try to build/debug our solution, we get following error: Unknown build error, 'Exception of type 'System.OutOfMemoryException' was thrown Only way to "fix" this issue is to reopen Visual Studio and then solution build goes well, but again after some time O...

Is it possible to turn off support for "and" / "or" boolean operator usage in gcc?

GCC seems to allow "and" / "or" to be used instead of "&&" / "||" in C++ code; however, as I expected, many compilers (notably MSVC 7) do not support this. The fact that GCC allows this has caused some annoyances for us in that we have different developers working on the same code base on multiple platforms and occasionally, these "error...

.NET Compiler Output

I'm attempting to resolve source problems and I'm attempting to figure out which version is which. The other problem I'm running into is the output the .NET compiler generates is very unintelligible and a little frustrating. In my bin folder i have the following assemblies: AjaxControlToolkit.dll AjaxControlToolkit.pdb App_Code.compil...

What strategies have you used to improve build times on large projects?

I once worked on a C++ project that took about an hour and a half for a full rebuild. Small edit, build, test cycles took about 5 to 10 minutes. It was an unproductive nightmare. What is the worst build times you ever had to handle? What strategies have you used to improve build times on large projects? Update: How much do you think...

Error c2061 when compiling

When I compile a project I get this error: C:\DATOSA~1\FAXENG~1>nmake /f Makefile.vc clean Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. cd src nmake /nologo /f Makefile.vc clean del /F *.obj *.lib *.dll *.exe *.res *.exp cd.. ...

How do I set Visual Studio 2008 C/C++ compiler options globally?

How do I set default C/C++ compiler options for all newly created projects in Visual Studio 2008? For example, I'd like to use the highest warning level. I know I can set these options for each project individually, but I'd like to change the defaults for ALL new projects. ...

Images for Assembler, Interpreter and Compiler?

I got an assignment to make hand-drawn posters of Assembler Interpreter Compiler I googled for images of above three but not able to get some exact images which can define the above three properly. Can anyone share some image links which will give an idea about what is Assembler, Interpreter and compiler in computers. Thanks ...

Looking for ideas on a computer science course project.

Hey. I'm taking a course titled Principles of Programming Languages, and I need to decide on a project to do this summer. Here is a short version of what the project needs to accomplish: "The nature of the project is language processing. Writing a Scheme/Lisp processor is a project of this type. A compiler for a language like C or Pasca...

How do C/C++ compilers work?

After over a decade of C/C++ coding, I've noticed the following pattern - very good programmers tend to have detailed knowledge of the innards of the compiler. I'm a reasonably good programmer, and I have an ad-hoc collection of compiler "superstitions", so I'd like to reboot my knowledge and start from the basics. Can anyone recommen...

Target architecture for Tiger-compiler

I am writing a Tiger compiler in F# and I have finally reached the point where I can no longer postpone the decision of a target architecture. This is my first compiler, but it will definitely not be my last. So... what would be a good target architecture for a first compiler? I have thought about targeting the CIL (.NET), but the inte...