How to cast a pointer in C++
void foo(void **Pointer); int main () { int *IntPtr; foo(&((void*)IntPtr)); } Why do I get an error? error: lvalue required as unary ‘&’ operand Thanks ...
void foo(void **Pointer); int main () { int *IntPtr; foo(&((void*)IntPtr)); } Why do I get an error? error: lvalue required as unary ‘&’ operand Thanks ...
I'm having some problems with the following code: private class ClientPluginLoader : MarshalByRefObject { public bool IsPluginAssembly(string filename) { AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomainReflectionOnlyAssemblyResolve); Assembly asm = Assembly.Reflectio...
What makes a type different from class and vice versa? (In the general language-agnostic sense) ...
I searched in linux box and saw it being typedef to typedef __time_t time_t; But could not find the __time_t definition. ...
My particular problem: I have a string which specifies an aribitrary type in a configuration class Config.numberType = "System.Foo"; where Foo is a type like Decimal or Double I use Type.GetType(Config.numberType) to return the corresponding type. How do I get from that type to being able to use, System.Foo.TryParse() ? Some furthe...
I am trying to decide if a string is a number in Ruby. This is my code whatAmI = "32.3a22" puts "This is always false " + String(whatAmI.is_a?(Fixnum)); isNum = false; begin Float(whatAmI) isNum = true; rescue Exception => e puts "What does Ruby say? " + e isNum = false; end puts isNum I realize that I can do it with a RegEx, ...
I have seen several standards for writing comments about the kind of data a function expects and returns in Python. Is there a consensus on which one is best-practice? Is the new functionality in http://www.python.org/dev/peps/pep-3107/ something I should start using for this? ...
I am wondering what type the 'value' keyword in a property takes. so: public class Test { string _numberAsString; int _number = -1; public Test() {} public string NumberAsString { get { return _numberAsString; } set { _numberAsString= value; } } public int Number { get { return...
I'm solving problems in Project Euler. Most of the problems solved by big numbers that exceeds ulong, Ex : ulong number = 81237146123746237846293567465365862854736263874623654728568263582; very sensitive decimal numbers with significant digits over 30 Ex : decimal dec = 0,324234254357389475693657647497826572638542856923...
In several C++ examples I see a use of the type size_t where I would have used a simple int. What's the difference, and why size_t should be better? Thank you folks. ...
Hi all, I'm trying to use Spring IoC with an interface like this: public interface ISimpleService<T> { void someOp(T t); T otherOp(); } Can Spring provide IoC based on the generic type argument T? I mean, something like this: public class SpringIocTest { @Autowired ISimpleService<Long> longSvc; @Autowired I...
View this code: function testprecision(){ var isNotNumber = parseFloat('1.3').toPrecision(6); alert(typeof isNotNumber); //=> string } I would have expected a number. If 'isNotNumber' should be a real number, recasting is the solution: alert(typeof parseFloat(isNotNumber)) //=> number [Edit] thanks for your answers. Precisi...
Is this possible? I can't find it anywhere. Thanks! ...
How can i find out if the obj returned by a func is a int or something else (like a sqlite cursor) ...
I want to search for multiple file types at once. For example, when I want to search for ".htm" files, I add "filetype:htm" to the query and that works fine. Similarly, "filetype:html" also works. However, how can I specify a query parameter that returns all htm AND html files? ...
I'd like to create a generic type hierarchy for representing graphs. In particular, I'd like like to have classes Graph and Node, and I want that for every Graph type, there is a corresponding Node type and if I create a generic function for manipulating Graphs, I want this function to use the actual Node type. An example that I tried t...
I'm looking for a more efficient way to find a type in an Assembly that derives from a known specific type. Basically, I have a plugin architecture in my application, and for the longest time we've been doing this: For Each t As Type In assem.GetTypes() If t.BaseType Is pluginType Then 'Do Stuff here' End If Next Some ...
I'm looking to add functionality to all the simple types in C++. I want to write a single templated class that takes as a template parameter the type to be encapsulated and then has all the operators defined so that the encapsulated class works exactly as the simple type it encapsulates. Something like this: template <typename _Simpl...
I'm trying to understand an academic paper (pdf) about programming language design. In particular, it describes a lightweight version of Java called Featherweight Java. It has typing rules with notation like this: x_ : C_, this : C |- e0 : E0 E0 <: C0 class C extends D {...} if mtype(m,D) = D_->D0, then C_ = D_ and C0 = D0 -----...
Hi, I'm new to Objective-C and I saw the "new type" BOOL (YES, NO). I read that this type is almost like a char. For testing I did : NSLog(@"Size of BOOL %d", sizeof(BOOL)); NSLog(@"Size of bool %d", sizeof(bool)); Good to see that both logs display "1" (sometimes in C++ bool is an int and its sizeof is 4) So I was just wondering ...