I know there is a standard behind all C compiler implementations, so there should be no hidden features. Despite that, I am sure all C developers have hidden/secret tricks they use all the time.
What is the shortest / most elegant way to implement the following Scala code with an abstract attribute in Python?
abstract class Controller {
val path: String
}
A subclass of Controller is enforced to define "path" by the Scala compiler. A subclass would look like this:
class MyController extends Controller {
override val path = "/home"
}
I am building an application using Action script 3 I am retrieving some XML from the web however the node names are mms:Image mms:Results etc my action script compiler is throwing an error becuase it is not expecting to see the semi colon in the node name. How to I access the nodes?
thanks
MacRuby 0.5 includes a ruby compiler built on LLVM called macrubyc.
Does anyone know if it would be possible to dynamically load gems from compiled code? Or compile the gems and link them in? Is this planned? Or how compiled code will be able to make use of gems in general.
I accidentally moved my Dynamic Data' folder into myImagesfolder. The project still compiles, but it's just not right. However, when I try to move it back to the root in Visual Studio, I get an error that the destination folder already exists. If I moveDynamic Data` back to the root outside of Visual Studio, the project no longer compiles because the compiler can't find any dynamic data files.
My infancy with git prompted me to ask here before embarking on an unpleasant 2am quest.
@protocol MyViewDelegate <NSObject>
- (void) didFinishProcessing:(MyView*)myView; //compiler stops here with error
@end
@interface MyView : MySuperclass {
id<MyViewDelegate> _delegate;
}
@property (nonatomic, retain) id<MyViewDelegate> delegate;
@end
When I try to compile I get " expected ')' before MyView ".
Where is the error?
I was curious to know what would happen if i assign a negative value to an unsigned variable.
The code will look somewhat like this.
unsigned int nVal = 0;
nVal = -5;
It didnt give me any compiler error. When i ran the nVal was having strange value. Could it be that some 2's complement value gets assigned to nVal.
Does anyone have experience developing with ESQL/C for INFORMIX-SQL, as in calling C funcs within "Perform" screen generator and "ACE" report writer?
I have ISQL without ESQL/C. I experimented compiling a perform screen, where in the instructions section I put "ON BEGINNING CALL userfunc() END" and although I don't have
ESQL/C, the Perform screen successfully compiled without errors!.. Apparently, the compiler didn't reject the C call even though there's no ESQL/C or C program linked.
When I compile a c++ application I'm writing that makes use of hash_map, I get this warning on g++ 4.3.2:
You are using the deprecated header . To eliminate this warning, use an ANSI-standard header file or use hte -Wno-deprecated compiler flag.
9> #include <ext/hash_map>
What include replaces this? I've searched for a while on google, and can't find anything except for people having similar problems, but no solution.
In this section of a function (.NET 2.0):
public void AttachInput(T input, int inIndex) where T : struct
{
if (input is int)
{
Inputs.Add(inIndex, (int)input);
InputCount++;
IsResolved = false;
}
}
The compiler shows the error "Cannot convert type 'T' to 'int'.
So, I used Convert.ToInt32() which worked - but does it box input to an object? Is there a better solution? Thanks
Can I get JAXB 2.0 XJC compiler to generate a generic class for me?
Something as simple as:-
public class Shape<T> {
T myShape;
// getter / setter
}
I see references for this in the spec but am not sure I'm reading it right. I always get Object references.
I have a very simple DLL written in unmanaged C++ that I access from my application. I recently switch to Visual Studio 2010, and the DLL went from 55k down to 35k with no code changes, and now it will no longer load in Windows 2000. I didn't change any code or compiler settings. I have my defines setup for 0x0500, which should include Windows 2000 support. Has anyone else run into this, or have any ideas of what I can do?
I want to use some of the libraries produced by the Eclipse project through Maven. I 've had a look at the main Maven repo and while it looks like that there are a few projects already imported, their versions are old and some important ones are missing (e.g. cdt). Is there any Eclipse project official Maven repository? If not, what would be the best option to use current versions of libraries such as the JDT compiler in a maven-enabled project?
I recently came upon a Microsoft article that touted new "defensive enhancements" of Windows 7. Specifically:
Address space layout randomization (ASLR)
Heap randomization
Stack randomization
The article went on to say that "...some of these defenses are in the core operating system, and the Microsoft Visual C++ compiler offers others" but didn't explain how these strategies would actually increase security.
Anyone know why memory randomization increases security, if at all? Do other platforms and compilers employ similar strategies?
Hello, recently I've been trying to debug some low level work and I could not find the crt0.S for the compiler(avr-gcc) but I did find a crt1.S
What is the difference between these two files? Is crt1 something completely different or what?
If I have a int32 type integer in the 8-bit processor's memory, say, 8051, how could I identify the endianess of that integer? Is it compiler specific? I think this is important when sending multybyte data through serial lines etc.
These questions are a kind of game, and I did not find the solution for them.
It is possible to write ::: in Cpp without using "" or anything like this and the compiler will accept it. (macro-s are prohibited too)
And the same is true for C# too, but in C#, you have to write ???.
I think Cpp will use the :: scope operator and C# will use '? :' , but I do not know the answers to them.
Any idea?
Although it runs correctly, the following results in the aforementioned compiler warning:
return ((item - (my->items))/(my->itemSize));
'item' is a 'void *'; 'my-items' is a 'void *'; 'my-itemSize' is an 'int'
Casting 'item' and 'my-items' as an 'int *' caused the program to run improperly. What is the best way to remove the warning?
Hi,
I am using 32 bit openSUSE OS, and I am using a cross compiler to build 64 bit application( it does not support building 32 apps) as our software will be deployed on a machine which is 64 bit OS. As testing on target is not always possible, is there anyway to run this applications on my 32 bit OS.
I have added three methods with parameters:
public static void doSomething(Object obj) {
System.out.println("Object called");
}
public static void doSomething(char[] obj) {
System.out.println("Array called");
}
public static void doSomething(Integer obj) {
System.out.println("Array called");
}
When I am calling doSomething(null) , then compiler throws error as ambiguous methods. So Is the issue because Integer and char[] methods or Integer and Object methods?
I have this snippet of the code
char *str = “123”;
if(str[0] == 1) printf("Hello\n");
why I can't receive my Hello thanks in advance!
how exactly compiler does this comparison if(str[0] == 1)?
So I just tried excluding String[] args from the main method
It compiled alright !
But JVM is showing an exception
Why did it compile when String[] args HAS to be included every time ?
What is going on here ? Why won't it show a compilation error ?
typing this made me think that may be compiler did not see it as THE main method ..is that so ?
When the c++ compiler generates very similar assembler code for a reference and pointer, why is using references preferred (and considered safer) compared to pointers?
I did see
Difference between pointer variable and reference variable in C++ which discusses the differences between them.
EDIT-1:
I was looking at the assembler code generated by g++ for this small program:
int main(int argc, char* argv[])
{
int a;
int &ra = a;
int *pa = &a;
}
I've created a new class that composes std::deque by private inheritance, i.e,
class B : private std::deque<A>
{ ... };
and in my source code I tried to use iterator of B, i.e.,
B::iterator it
The compiler error is
error C2247: 'std::deque<_Ty>::iterator' not accessible because 'B' uses 'private' to inherit from 'std::deque<_Ty>'
So the question is, how can I make the iterator accessible?
I'm trying to compile some Microsoft SAPI example code in a non-Microsoft C++ Compiler, and am getting an error at this line:
_HFILE m_hfilePrev;
Presumably because it doesn't recognize the _HFILE #define. Does anybody know what .h file I should include for that?