static

static library dependencies

Hello everyone, I have a static library (.lib file) on Windows platform, I want to know the dependent version of CRT library when the lib is built. I have no source code of the .lib file, any ideas? thanks in advance, George ...

Query on Static member variables of a class in C++

Sorry if this question seems trivial to many here. In a C++ code there is something as below: class Foo { public: static int bands; ... ... private: ... ... }//class definition ends int Foo::bands; //Note: here its not initialized to any value! Why is the above statement needed again when 'bands' is once declared in...

static library on Windows platform issue

Hello everyone, Two questions about static library on Windows platform, How to check whether a lib is a static library (or not, e.g. import library for a DLL or some other format which is not a legal static library file even if file name has .lib extension); How to check whether MT or MD flag is used when build a static library? tha...

Would it be wrong to use a static object instead of a database?

This is essentially a design patterns question: I was expecting to query a database to get a list of stocks(shares/securites whatever) that are most highly correlated for a given stock. Instead I thought maybe I should create an object which has a static HashMap and store my data in there. Then "query" it every time I need to. Would ...

Can I reset a static/shared class?

I've got a shared class (static in C#) which mostly carries some settings data that any class in the application can read and sometimes write. Also there are some static properties which holds some internal states. Now I want to revert this class to initial stage of it. With all default variables etc. Assume that the user want to reset ...

C#, implement 'static abstract' like methods.

I recently ran into a problem where it seems I need a 'static abstract' method. I know why it is impossible, but how to work around? For example I have an abstract class which have a description string. Since this string is common for all instances it is marked as static, but I want to require that all classes derived from this class pr...

Static Members of an Instance Class

Do static members of an instance class only live as long as the instance itself, or would the static member live throughout the life of the application? For instance, say I have a Hashtable as a static property. If I added items to it from one "Instance" would they be available from another "Instance"? ...

c++ accidental static

I've got a linked list class and for some reason when I increment an int in one object e.g linked1.size for some reason linked2.size also increments! And ideas why this is? I didn't intentionally make it a static variable. my code: main() { Vlist v1; v1.add(1,0); v1.add(2,0); Vlist v2; } Incrementing the size member vari...

Why should I use malloc() when "char bigchar[ 1 << 31 - 1 ];" works just fine?

What's the advantage of using malloc (besides the NULL return on failure) over static arrays? The following program will eat up all my ram and start filling swap only if the loops are uncommented. It does not crash. ... #include unsigned int bigint[ 1 << 29 - 1 ]; unsigned char bigchar[ 1 << 31 - 1 ]; int main (int argc, char **argv)...

Advantage of Static class over use of Singleton

Duplicate What’s wrong with singleton? Singletons: good design or a crutch? Singleton: How should it be used What is so bad about Singletons You can find numerous reasons for using a Singleton over a Static class. But there must surely be some situations where it is better to use a static class before a Singleton. What ar...

Given a pointer to a C++ object, what is the preferred way to call a static member function?

Say I have: class A { public: static void DoStuff(); // ... more methods here ... }; And later on I have a function that wants to call DoStuff: B::SomeFunction(A* a_ptr) { Is it better to say: a_ptr->DoStuff(); } Or is the following better even though I have an instance pointer: A::DoStuff() } This is purely ...

Why would only the prefixing return type of a java method execute ?

Hi, I am trying to understand some java code which for some reason appears to execute its return type class (the SQLExecutionInfo class) and nothing else within the method. Perhaps this is simply how the java works (i.e regardless of whether of what is within the method body the type of class being returned is first executed ??) The m...

Objective-C: how to delcare a static member that is visible to subclasses?

Hi Im declaring a family of static classes that deals with a communications protocol. I want to declare a parent class that process common messages like ACKs, inline errors... I need to have a static var that mantain the current element being processed and I want to declare it in the parent class. I do it like this: parent.m @implem...

Static class vs instanced class

Duplicate Should C# methods that can be static be static? Please forgive me if this question seems elementary - I'm looking over some source code that otherwise looks pretty good, but it's raised some questions... If a given class has no member data - i.e. it doesn't maintain any sort of state, are there any benefits in not ma...

Can you pass a class (not an object) is a parameter to a method in python?

I want to do something like the following class A: def static_method_A(): print "hello" def main(param=A): param.static_method_A() I want this to be equivalent to A.static_method(). Is this possible? ...

ThreadStatic Modified with Static C#

I have some code where I use a thread static object in C#. [ThreadStatic] private DataContext connection I was wondering, in this case, what if any change would I get if I put the static modifier on the thread static context? [ThreadStatic] private static DataContext connection With the first would there be one copy of the context ...

How to serve all existing static files directly with NGINX, but proxy to Apache the rest?

location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if (-f $request_filename) { access_log off; expires 30d; break; } if (!-f $request_filename) { proxy_pass http://127.0.0.1:8080; # A...

Java Utility Class vs. Service

What's the difference in Java between a utility class (a class with static methods) and a Service class (a class with public methods that provides a "service"). For example, one can argue that a cryptographic object (providing methods to encrypt, decrypt, hash or get a salt value) is a Service provider, but many group this functionality...

How to force destruction order of static objects in different dlls?

I have 2 static objects in 2 different dlls: An object Resources (which is a singleton), and an object User. Object User in its destructor has to access object Resources. How can I force object Resources not to be destructed before object User? ...

Is it wrong to have static and non-static methods in the same class?

Is it wrong to have static and non-static methods in the same class? ...