I am unclear about the following.
First, this code compiles fine:
#include <vector>
typedef struct{
int x1,x2,x3,x4;
} ints;
typedef std::vector<ints> vec;
int main(){
vec v;
ints a = {0,1,2,3};
v.push_back(a);
}
The following code is near identical:
#include <vector>
typedef std::vector<int[4]> vec;
int main(){
vec v;
i...
The following code compiles, but fails with a NullReferenceException:
class Test
{
public Dictionary<string, string> Dictionary { get; set; }
}
static void Main(string[] args)
{
var x = new Test
{
Dictionary = // fails
{
{ "key", "value" }, { "key2", "value2" }
}
};
}
If you repla...
I am a CS student and I have a compiler project this year.
I want to know how to manage my project with my three partners.
I know that the compiler has many level and process, and I want to make use of these features to mange my project.
Thanks for any tips/pointers/resources you can provide for me to start.
...
Hello,
I want to build "gcc cross-compiler" to compile "c/c++" applications on "Linux" environment but for "Windows" target.
I have made this so far:
Installed the necessary tools and packages for building GCC listed on "Prerequisites for GCC" page.
Downloaded required sources:
"gcc-core-4.4.1", "gcc-g++-4.4.1", "binutils-2.19.1", "w...
I've built a custom RoleProvider which uses an already existing datasource (from a web service) to dtermine roles.
It's written in C#, and I want to be able to compile it as a DLL so I can distribute it to others within the organisation and they can use it too.
When compiling, how do I reference the web service?
Currently getting this ...
I'm toying around with OCaml. The first thing I want to know how to do is build an OCaml project. Right now, I just want something stupidly simple since I'm just learning. Could anyone point me towards a build system along with a "hello world" type example for using that build system?
...
I would like to design a math language satisfying EBNF, to let me write equation systems and inequalities as close to natural math language as possible. I would like to have two parsers for this little language, one parser prepares the equalities/inequalities written in this language for publication, another parser prepares it for comput...
In C++, is it possible to force the compiler to arrange a series of global or static objects in a sequential memory position? Or is this the default behavior? For example, if I write…
MyClass g_first (“first”);
MyClass g_second (“second”);
MyClass g_third (“third”);
… will these objects occupy a continuous chunk of memory, or is the...
Before answering this question, understand that I am not asking how to create my own programming language, I am asking how, using vb.net code, I can create a compiler for a language like vb.net itself. Essentially, the user inputs code, they get a .exe. By NO MEANS do I want to write my own language, as it seems other compiler related qu...
error CS0583: Internal Compiler Error (0xc0000017 at address 7C812AFB): likely culprit is 'IMPORT'.
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occu...
I understand how a language can bootstrap itself, but I haven't been able to find much reference on why you should consider bootstrapping.
The intuitive answer is that the language you're writing offers utilities that are not found in the "base" language of the compiler, and the language's features are relatively well-suited for a compi...
Is newline and whitespaces the same in compiler design? what if you write a macro to replace newlines by whitespaces, is this correct or would it cause some form of problems?
...
I'm writing a demo compiler for a toy programming language in C.
What problems can arise if we do macro processing in a separate phase between reading the program and lexical analysis?
...
I am studying Compilers course, compilation of program follows below steps
Lexical analysis
Syntax analysis
Semantic analysis
Intermediate code generation
Code optimization
Target code generation.
How can I see output of each step e.g I want to see parse tree after syntax analysis.
I am compiling program on Linux machine with GCC co...
Hi there, I have a C# library (DLL)
// ProgramLib.cs //
using System;
namespace ProgramLibrary
{
public class Lib
{
public Lib()
{
Console.WriteLine("Lib Created");
}
}
}
And I have the following console program
// Program.cs //
using System;
using ProgramLibrary;
class MainClass
{
...
Just out of interest. How does GCC's C++ implementation handle it's standard number types being divided by zero?
Also interested in hearing about how other compiler's work in relation to zero division.
Feel free to go into detail.
This is not purely for entertainment as it semi-relates to a uni assignment.
Cheers, Chaz
...
I have a system that compiles C# code at runtime. I would like the generated assemblies to be linked to the system itself. Here's some example code that I am using:
CSharpCodeProvider provider = new CSharpCodeProvider(new Dictionary<String, String> { { "CompilerVersion", "v3.5" } });
CompilerParameters compilerparams = new CompilerParam...
Hi,
I wanted to know Why compiler provides default copy constructor..Whats the strategy behind that idea.
Thanks in Advance.
...
Looking for a Smalltalk compiler that given Smalltalk (Instantiations) will emit either Java bytecode, .NET CLR or Ruby. Not looking for porting utilities as I want to leave the application in Smalltalk.
I have googled for solutions and ran across a company who had a website (http://www.smalltalkmigrations.com/) but it seems as if they ...
Why reference types and pointers are same in compiled code?(You can see in third and fourth line). I tried to figure it out but apparently I could not achieve.
If a reference type variable must be initialized at declaration and can not be changed so is there any need to do indirection as in pointers?
int x = 10;
mov dword ptr...