compiler

The Dragon Book

Is the Dragon book a good introductory textbook for a compiler class? It seems to be famous, and our professor likes it, but it's not one of the textbooks that we use. ...

Does this grammar allow scope nesting?

I'm only able to make functions inside the global scope. Scope nesting means being able make functions within functions, right? I'm not able to do that with this grammar. Is it possible? /* C-Minus BNF Grammar */ %token ELSE %token IF %token INT %token RETURN %token VOID %token WHILE %token ID %token NUM %token LTE %token GTE %tok...

[C++] Array of char or std::string for a public library?

Hi, my question is simple: Should I use array of char eg: char *buf, buf2[MAX_STRING_LENGTH] etc or should I use std::string in a library that will be used by other programmers where they can use it on any SO and compiler of their choice? Considering performance and portability... from my point of view, std strings are eas...

How to detect Windows XP or Windows 2000 OS to run a CVI executable

Hello, I am using NI LabWindows CVI 8.1 to compile and build a executable program which I need to run on either Windows XP and Windows 2000 OS. I use Windows XP to compile and build the executable. The info I have so far is that I need to place some statement as follows: ifdef (windows xp) then specify path as C:\WINDOWS\system32 elif...

Open Watcom C++ Compiler Compilation Problem

I'm trying to compile a basic "hello world" file with the Open Watcom C++ compiler for Windows. Here's the error I get: wpp386 hello.cpp Open Watcom C++32 Optimizing Compiler Version 1.8 Portions Copyright (c) 1989-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://w...

Firefox 3.6 build error on Windows VS2005 - C compiler cannot create executables

I am trying to build Firefox 3.6 Beta 4 using Visual Studio 2005 on Windows. I downloaded the release source, the latest version of mozilla build, but get the error "C compiler cannot create executables.". I have been able to build all other 3.5 and previous versions without any issues. The problem occurs at the start of the build proce...

Byte precision pointer arithmetic in C when sizeof(char) != 1

How can one portably perform pointer arithmetic with single byte precision? Keep in mind that: char is not 1 byte on all platforms sizeof(void) == 1 is only available as an extension in GCC While some platforms may have pointer deref pointer alignment restrictions, arithmetic may still require a finer granularity than the size of the ...

Assembly Language & Compiled Languages

How is assembly faster than compiled languages if both are translated to machine code. I'm talking about truly compiled languages which are translated to machine code? Not C# or Java which are compiled to an intermediate language first and then compiled to native code by a software interpreter etc. In Wikipedia, I found something which ...

GCC performance

Hello, I am doing parallel programming with MPI on Beowulf cluster. We wrote parallel algorithm for simulated annealing. It works fine. We expect 15 time faster execution than with serial code. But we did some execution of serial C code on different architectures and operating systems just so we could have different data sets for perfor...

Compiling to idiomatic C

Are there any compilers out there for function or lisp-ish languages that compile to idiomatic C? Most compilers out there seem to provide something resembling a machine language composed of C macros. I'm wondering if there is anything out there that can produce readable C code based on a higher-level language. ...

Which C# compiler errors are undocumented?

This is meant to be a collection of possible C# compiler errors that are not documented. If you encounter such an error, please post an answer here listing: The error number (CSnnnn) The associated error message If possible, a small snippet of code that will produce the error Example: CS0224: A method with vararg cann...

Compile C file without _cplusplus def

I'm trying to compile a C file that contains jni.h. The C code is a wrapper for my Java call to a C method. The code example that I'm trying to compile on my machine received compile errors for jstring and jclass. I believe it is due to Visual Studio cl command compile using the cplusplus option and I cannot get it to reference the co...

MSBuild: Conditional Construct (Project Reference | File Reference)

I´m still trying to eleminate the need of a cobol compiler in a Project with cobol-Projects in it. Is it possible to create following build behaviour: If the Configuration is Debug then use ProjectReferences on ExCobol.cblproj if the Configuration is DebugVB then use FileReferences on ExCobol.dll When Yes, How to achieve it? I assum...

Reserved keywords in Objective-C?

At the CocoaHeads Öresund meeting yesterday, peylow had constructed a great ObjC quiz. The competition was intense and three people were left with the same score when the final question was to be evaluated: How many reserved keywords does Objective-C add to C? Some spirited debate followed. All agreed that @interface, @implementation et...

gcc difference between -pthread and -pthreads?

I have a pthreads program. I have to compile it with gcc -pthread in Linux (-pthreads is unrecognized option) and gcc -pthreads in Sun (-pthread is unrecognized option). Why the difference, since it's the same compiler? However, -lpthread works on both, but I heard this isn't always sufficient. ...

How to disable remark "LOOP WAS VECTORIZED" written by Intel compiler?

I want to disable remark "LOOP WAS VECTORIZED" written by Intel compiler. But I don't want to disable optimazation. What do I need to do? ...

include boost header file using "" or <>

Why tuple documentation for example says to use: #include "boost/tuple/tuple.hpp" and not #include <boost/tuple/tuple.hpp> I know that it's almost not probably my code will have also boost/tuple/tuple.hpp, but using include <> states explicitly not to look in the curent directory. So what is the reason? ...

What is the compiler of Samsung Bada?

Hello, Recently Samsung presented Bada platform for mobile phone. http://developer.bada.com/apis/index.do I can find developer materials from the above web page but, I can't find how can I compile it and what is the compiler? This is C++ based framework and Samsung said Bada is operating system agnostic. In this case, how application...

What programming languages target J2ME?

I recently received a Nokia 5000 phone. Now I want to write software for it. Trouble is, I don't know Java. Now I've heard of other languages which supposedly make possible development without recourse to Java, languages like CellularBASIC (which looks a bit like QBASIC) and Hecl (which seems to be based on Tcl). Are these the only on...

Can a Scala program be compiled to run on any JVM, without having Scala installed on the given machine?

If I've writen a Scala program, can I compile it in a way so that anybody with a standard Sun Java JVM can run it? I guess the Scala compiler would have to include the Scala-specific API code in the compiled project? The reason I'm interested is that our class projects can usually be delivered in whatever language one prefers, but TAs gr...