base class:
Class List(Of T)
Function Contains(ByVal value As T) As Boolean
derived class:
Class Bar : List(Of Exception) ' Exception type as example '
Function Contains(Of U)(ByVal value As U) As Boolean
compiler tells me that that two are the same, so I need to declare Overloads/new this second function.
But I want use U to differentiate the type (one logic) like NullReferenceException, ArgumentNull Exception, etc. but want to leave the base function(no differentiation by type - other logic) as well.
As far as I know there is no web browser with built in validators for HTML, CSS and JavaScript. Developing web pages without validation is like using a compiler that doesn't do syntax analysis. Even Firefox with its excellent plugins aimed at developers like Firebug lacks plugins for CSS and JavaScript validation. Wouldn't it be useful to have these plugins? Am I missing something?
I have the problem that C++ compiler does a recompile without any changes done.
Does anyone of you know how to get a list on criterias why VisualStudio decides to start a compilation.
These questions are a kind of game, and I did not find the solution for them.
It is possible to write ::: in C++ without using quotes or anything like this and the compiler will accept it (macros are prohibited too).
And the same is true for C# too, but in C#, you have to write ???.
I think C++ will use the :: scope operator and C# will use ? : , but I do not know the answers to them.
Any idea?
It seems like I should be able to perform bit shift in C/C++ by more than 32 bits provided the left operand of the shift is a long. But this doesn't seem to work, at least with the g++ compiler.
Example:
unsigned long A = (1L << 37)
gives
A = 0
which isn't what I want. Am I missing something or is this just not possible?
-J
I'm doing a library that makes extensive use of a thread local variable.
Can you point to some benchmarks that test the performances of the different ways to get thread local variables in C++:
C++0x thread_local variables
compiler extension (Gcc __thread, ...)
boost::threads_specific_ptr
pthread
Windows
...
Does C++0x thread_local performs much better on the compilers providing it?
I'm relatively new to C, and am curious what this syntax means in a function declaration:
int DEFAULT_CC foo(void)
where DEFAULT_CC is probably defined somewhere else as:
#define DEFAULT_CC "cc"
Is this a direction to use a certain compiler or something?
Hi guys.
Dose anyone knows why I have to use -use-network=false in my Flex Builder?!?!?!
This is set inside the Project Properties and is Additional compiler argument.
This is only when I want to read in a external file like XML.
Others in my team doesn't have to have -use-network=false ????
I have two classes that I'm using to represent some hardware: A Button and an InputPin class which represent a button that will change the value of an IC's input pin when it's pressed down. A simple example of them is:
template <int pinNumber> class InputPin
{
static bool IsHigh()
{
return ( (*portAddress) & (1<<pinNumber) );
}
};
template <typename InputPin> class Button
{
static bool IsPressed()
{
return !InputPin::IsHigh();
}
};
This works beautifully and by using class templates, the condition below will compile as tightly as if I'd handwritten it in assembly (a single instruction).
Button < InputPin<1> > powerButton;
if (powerButton.IsPressed())
........;
However, I am extending it to deal with interrupts and have got a problem with circular references.
Compared to the original InputPin, a new InputPinIRQ class has an extra static member function that will be called automatically by the hardware when the pin value changes. I'd like it to be able to notify the Button class of this, so that the Button class can then notify the main application that it has been pressed/released. I am currently doing this with function pointers to callbacks. In order for the callback code to be inlined by the compiler, I need to pass the function pointers as template parameters. So now, both of the new classes have an extra template parameter that is a pointer to a callback function. Unfortunately this gives me a circular reference because to instantiate a ButtonIRQ class I now have to do something like this:
ButtonIRQ< InputPinIRQ< A1, ButtonIRQ<....>::OnPinChange, OnButtonChange > pB;
where the <...... represents the circular reference.
Does anyone know how I can avoid this circular reference? I am new to templates, so might be missing something really simple.
It's important that the compiler knows exactly what code will be run when the interrupt occurs as it then does some very useful optimisation - it is able to inline the callback function and literally inserts the callback function's code at the exact address that is called on a h/w interrupt.
I'm refactoring an old C code. The code has absolutely no layered architecture (everything is being accessed by everything) and I'm trying to change that.
I would like to cut direct access to structure members (at least write for now) and only allow access through access functions. Is there some tool (or perhaps directly the compiler) that could check this rule for me?
I need this since I'm maintaining a fork and the upstream isn't very concerned with code quality.
Under what circumstances will the "False" part of the following code be executed?
x = 20;
y = -30;
if (x > y) {
// True part
}
else {
// False part
}
NB: Language is C, compiler is gcc (although some other compilers may also do the same thing).
Suppose, I have a 'if statement' inside a 'for-loop'.
for( ; ; )
{
-------
if( )
{
printf(" inside if");
break;
}//if
printf("inside for");
}//for
now, will the 'break-statement' cause the compiler to come out of the 'for-loop' or will it only come out of the if loop on the 'if-condition' being satisfied.
How to declare a static dictionary object inside a static class? I tried
public static class ErrorCode
{
public const IDictionary<string , string > ErrorCodeDic
=new Dictionary<string, string>()
{
{"1","User name or password problem"}
};
}
But the compiler complains that "A const field of a reference type other than string can only be initialized with null".
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 (and the same with the corresponding .o files)
What is the difference between these two files? Is crt1 something completely different or what? They both seem to have to do with something for bootstrapping(setting up stack frame and such), but why the distinction?
Suppose I have an arbitrary function:
void someFunc(int, double, char);
and I call someFunc(8, 2.4, 'a');, what actually happens? How does 8, 2.4, and 'a' get memory, moved into that memory, and passed into the function? What type of optimizations does the compiler have for situations like these? What if I mix and match parameters, such like someFunc(myIntVar, 2.4, someChar);?
What happens if the function is declared as inline?
My Herb Schildt book on C++ says: "... In C++, if a function is declared as returning a value, it must return a value." However, if I write a function with a non-void return type and do not return anything, the compiler issues a warning instead of an error: "Control reaches end of non-void function."
I use gcc (MinGW) and have set the -pedantic flag.
Switching aged 2003 SRV to 2008 caused my Asp.net 2 application fail: The application is no more loading the required library DLL from /bin/ folder anymore.
What should I change in my code or web.config to make this webapp load OK also in new 2008 server?
Now I receive this error when I access the application: This type is in IMPORTS ( Dll ).
Compiler Error Message: BC30002: Type
'Facebook.Entity.User' is not defined.
I'm implementing a compiler in my Compilers class, I'm using Qt & C++.
After I have generated the machine code from the source code, I'm executing the virtual machine that will execute the call.
I'm facing a problem here, I'm using readyRead() signal to get output from the virtual machine, but how can I know that the virtual machine wants to read data from the user?
I wanna show the user an input dialog each time the machine asks for input.
private static void printIterable(Iterable iterable) {
// ERROR: "Type mismatch: cannot convert from element type Object to Iterable"
for (Iterable i : iterable) {
System.out.println(i);
}
}
What the compiler is talking about? Its an Iterable, not an Object.
Consider this expression as a "selection" control structure on integer "x":
0 < x < 10,
with the intention that the structure returns TRUE if "x" is in the range 1..9.
Explain why a compiler should not accept this expression. (In particular, what are the issues regarding the binary operator "<"?
Explain how a prefix operator could be introduced so the expression can be successfully processed.
What's going on when the assignment statement executed at Line 4, does compiler ignore the new operator and keep the foo variable being null or something else happen to handle this awkward moment?
public class Foo {
// creating an instance before its constructor has been invoked, suppose the "initializing"
// gets printed in constructor as a result of the next line, of course it will not print it
private Foo foo = new Foo();//Line 4
public Foo() {
System.out.println("initializing");
}
}