compiler

g++ or gcc option to get warning message with warning id.

Hi, By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more option to get a more detailed warning message ? (Th...

Class will compile for Tests/Console but not in Asp.net application

I have a simple interface: public interface IVisitorsLogController { List<VisitorsLog> GetVisitorsLog(); int GetUniqueSubscribersCount(); int GetVisitorsCount(); string GetVisitorsSummary(); } the class VisitorsLogController implements this interface. From a console application or a TestFixture - no problem - the co...

Looking for 16-bit x86 compiler

I am working on an embedded systems project and have run into an issue of the compiler being programatically embedded in the Paradigm C++ IDE. I would like to be able to automate building. The processor is the AMD186ES. I am not working with the OS - just baremetal stuff. I need to generate real-mode 16-bit 8086 machine code from C++. ...

Counterpart of PHP's isset() in C/C++

PHP has a very nice function, isset($variableName). It checks if $variableName is already defined in the program or not. Can we build similar feature for C/C++ (some kind of symbol table lookup)? ...

What features would you like to see in the win32 Delphi Compiler?

Delphi (the language) has its own syntax and features, and other languages have their own too. As a Delphi developer, what would you like to have in the win32 Delphi compiler? And if you are not a Delphi developer, what features would make you starting using Delphi? Here's my short list Main Features: Cross platform compiler (Revive...

Is non multiple of machine word primitives good idea?

Let's say you have a dynamic language (similar to common scripting languages) and want to write a compiler for it. Is it good idea to reserve some bits of a machine word for something like type tags? Especially for microcontrollers and similar devices, is it a good idea? I can think of some advantages like reduced storage for type infor...

Do modern compilers optimize the x * 2 operation to x << 1?

Does the C++ compiler optimize this operation? I would love to believe that yes. ...

i want a java editor with embedded compiler and work under linux and did not require a a big amount of ram.

I want a Java IDE with a compiler for Linux and that does not require a a big amount of RAM. I have 256 MB of ram, so my options are limited ...

Learning the source code's filename at compile time

I'm using GCC; __FILE__ returns the current source file's entire path and name. Is there a way to get just the file's name and not its whole path too (at compile time)? Is it possible to do this in a portable way? Can template meta programming be applied to strings? I am using this in an error logging macro. I really do not want my sour...

Can a C compiler rearrange stack variables?

I have worked on projects for embedded systems in the past where we have rearranged the order of declaration of stack variables to decrease the size of the resulting executable. For instance, if we had: void func() { char c; int i; short s; ... We would reorder this to be: void func() { int i; short s; ch...

Added code, swf size got ... smaller?

... I'm working on a couple of theories, but I'm interested to hear other opinions. This has been verified on three different machines, two windows the other linux. The compiler used is flexbuild (Presumably mxmlc) and ant with mxmlc. We added code to a small stand-alone single .as file project and the compiled swf file size went down ...

javac error "code too large"??

I have a unit test where I have statically defined a quite large byte array (over 8000 bytes) as the byte data of a file I don't want to read every time I run my unit test. private static final byte[] FILE_DATA = new byte[] { 12,-2,123,................ } This compiles fine within Eclipse, but when compiling via Ant script I get the fo...

How do I tokenize input using Java's Scanner class and regular expressions?

Just for my own purposes, I'm trying to build a tokenizer in Java where I can define a regular grammar and have it tokenize input based on that. The StringTokenizer class is depracated, and I've found a couple functions in Scanner that hint towards what I want to do, but no luck yet. Anyone know a good way of going about this? ...

Which standard c++ classes cannot be reimplemented in c++?

I was looking through the plans for C++0x and came upon std::initializer_list for implementing initializer lists in user classes. This class could not be implemented in C++ without using itself, or else using some "compiler magic". If it could, it wouldn't be needed since whatever technique you used to implement initializer_list could ...

Force C# compiler error based on const value

I have a private const int defined in a C# class. I want compilation to fail with an error if the value of this int mod 3 != 0. How can I accomplish this? ...

Why doesn't anyone upgrade their C compiler with advanced features?

struct elem { int i; char k; }; elem user; // compile error! struct elem user; // this is correct In the above piece of code we are getting an error for the first declaration. But this error doesn't occur with a C++ compiler. In C++ we don't need to use the keyword struct again and again. So why doesn't anyone update their C compile...

C# Action lambda limitation

Why does this lambda expression not compile? Action a = () => throw new InvalidOperationException(); Conjecture is fine, but I would really appreciate references to the C# language specification or other documentation. And yes, I know that the following is valid and will compile: Action a = () => { throw new InvalidOperationExceptio...

Would syntax for composition be a useful addition to Java?

First off, I know next to nothing about language theory, and I barely know any other languages except Java, but I had an idea that I think would be cool, but I need you guys to tell me: a: why it sucks b: how language x has had that for years c: how my mind sucks d: all of the above The idea would give composition the same ease of code ...

Which parser generator to teach my students?

I am teaching (with others) a relatively introductory course in computer science for IT professionals without a background in CS. Since I developed the course materials on automata and grammars, I am also responsible for teaching about compilers and compiler construction. Years ago, when I studied compilation in college, all our example...

Register allocation rules in code generated by major C/C++ compilers

I remember some rules from a time ago (pre-32bit Intel processors), when was quite frequent (at least for me) having to analyze the assembly output generated by C/C++ compilers (in my case, Borland/Turbo at that time) to find performance bottlenecks, and to safely mix assembly routines with C/C++ code. Things like using the SI register f...