An abstract base class (ABC) can have data to support the classes that inherit form it.
However, given that its not possible to instantiate an object of an ABC how does the compiler handle this data for cases where we have a number of derived class objects that
inherit the ABC. Does the data become associated with the derived class obje...
Recently several tools have been released such as pyjamas and Scheme2js that allow one to take code in a language such as Python or Scheme and compile it to Javascript.
But how practical is such a tool?
I could see debugging being quite painful as you would have to debug the compiled javascript code itself, and correlate any bugs in ...
Hi,
I have a local install and a live install. My live install is working except I changed one of the methods to be restricted via [Authorize(Roles = "Admin, Host")] I want to remove this, but I need to do a build of the solution and move the .dll over for it to work (correct me if I'm wrong).
I cannot build the solution because my loc...
Ever since I realized many years ago, that this doesn't produce an error by default, (in gcc at least) I've always wondered why?
I understand that you can issue compiler flags to produce a warning, but shouldn't it always be an error? Why does it make sense for a non-void function not returning value to be valid?
An example as requeste...
In C code like such:
{
int i = 5;
/* ....... */
}
The compiler will replace the code by moving the Stack pointer down (for stacks growing down) by the size of an int, and places the value 5 in that memory place.
Similarly, in C++ code, what does the compiler do if an object is created? For example:
class b
{
public :
...
I was just working on some code and caught myself making this error
if (stringName == "firstName" || "lastName")
// Do code
obviously this is wrong and should be
if (stringName == "firstName" || stringName == "lastName")
// Do code
but it just got me thinking in regards to readability would the first be easier? Maybe havin...
Hi ,
I have a multi-R/W lock class that keeps the read, write and pending read , pending write counters. A mutex guards them from multiple threads.
My question is Do we still need the counters to be declared as volatile so that the compiler won't screw it up while doing the optimization.
Or does the compiler takes into account that t...
How to eliminate left recursion for the following grammar?
E := EE+|EE-|id
Using the common procedure:
A := Aa|b
translates to:
A := b|A'
A' := ϵ| Aa
Applying this to the original grammar we get:
A = E, a = (E+|E-) and b = id
Therefore:
E := id|E'
E' := ϵ|E(E+|E-)
But this grammar seems incorrect because
ϵE+ -> ϵ id +
w...
I always like to use the variable with the smallest size that will work just fine, But would this really gain me if I used short byte integers instead of integer, and the memory is 32bit word addressable, Does the compiler do something to enhance memory usage ?
...
Are there c++ compilers that I can run on a brand x system that will create machine code that will run on a brand y system? Would this be considered a cross compiler?
...
According to me, it is zero but there seems to be bit confusion here
I have tested it with gcc compiler and it gives me zero as output. I know that in C++, size of an empty class is 1. Let me know if I am missing anything here.
...
Reading through some of the questions here, the general concensus seems to be that there to continues to be an enourmous amount of COBOL code "out there", not just because it's a nightmare to refactor or re-code, but simply because for a certain market segment (financials etc.), it has proven itself to be more than capable of holding its...
In the spirit of this question, I'd like to ask a similar question, but about compilers, not about interpreters.
What is the conceptually smallest compiler that can compile its own code?
When I say "conceptually smallest" I mean that it uses only very basic concepts and builds up from there, rather than that it contains very short code...
My app uses the camera, and I added the zoom function thanks to 3.1 API (cameraViewTransform most importantly). But I want my app to run also on 3.0 (without the zoom of course). The problem is that, I cannot compile the app in 3.0 due to this line which calls 3.1 properties:
CGAffineTransform initialTransform = photoPicker.cameraViewTr...
I have the following code:
gcc test.c -o test -D ARGUMENT 2
and I want it to define ARGUMENT with a value of 2 but it says cannot find file 2 or something. How do I do this?
...
Why does this code
int (*g)(int);
int (*h)(char);
h = g;
In C, give me such warning when compiling:
'warning: assignment from incompatible pointer type'
In C++, can't be able to compile.
...
Hi all,
Despite warnings to drop my present course of action, I currently see no better way to solve my problem. I must generate Java code at runtime, then compile it, load it and reference it.
Problem is that the generated code imports code that has already been loaded by the system class loader (I suppose) - that is, code present in ...
I was bored and playing around with various options to gcc to see what size binaries I could produce.
I found a -s flag in ld64 that is supposedly supposed to not include symbol table information in an executable. The manpage for ld64 says the flag is ignored.
The manpage for gcc says it's a linker option(which to me implies it means i...
Forgive me—newbie gcc question. Is there a set of command-line options that will convince gcc to produce a flat binary file from a self-contained source file? For example, suppose the contents of foo.c are
static int f(int x)
{
int y = x*x;
return y+2;
}
No external references, nothing to export to the linker. I'd like to get a s...
What tool or method can I use to see what code something like an anonymous method or LINQ statement gets compiled to? Basicly seeing what happens behind the scene?
...