Meaning of this #pragma notation
What could be the meaning of this notation. #pragma warning( disable : 4530 ) ...
What could be the meaning of this notation. #pragma warning( disable : 4530 ) ...
Hi I am working on some strange piece of code ,For me its not good piece of code. PIP_ADAPTER_INFO pAdapterInfo=(PIP_ADAPTER_INFO)new char[sizeof(IP_IP_ADAPTER_INFO)]; . . . delete []pAdapterInfo; Here PIP_ADAPTER_INFO is pointer to struct IP_IP_ADAPTER_INFO , size of IP_IP_ADAPTER_INFO is 640. I wa...
I'm a Scala/Java programmer looking to reintroduce myself to C++ and learn some of the exciting features in C++0x. I wanted to start by designing my own slightly functional collections library, based on Scala's collections, so that I could get a solid understanding of templates. The problem I'm running into is that the compiler doesn't s...
Could all those CORBA experts out there please help me with this one. I have a multithreaded application with some code that sends a message to a server and waits for a response back. I can see that the server is sending the response back however the application doesnt seem to receive it. Heres part of my code. // Create a request o...
plugin1.cpp: #include <iostream> static class TestStatic { public: TestStatic() { std::cout << "TestStatic create" << std::endl; } ~TestStatic() { std::cout << "TestStatic destroy" << std::endl; } } test_static; host.cpp #include <dlfcn.h> #include <iostream> int main(int argc,char argv*[]) { void* handle = dlop...
I have a pair pointer let us suppose std::pair< A*, B* >* pointerpair. I allocated it memory and after using the pair i call delete pointerpair. Will it also call delete A and delete B and will be freeing the memory completely ? if i only call delete A and delete B but no delete pointerpair then is it a memory leak ? ...
All, I'm writing some performance sensitive code, including a 3d vector class that will be doing lots of cross-products. As a long-time C++ programmer, I know all about the evils of macros and the various benefits of inline functions. I've long been under the impression that inline functions should be approximately the same speed as m...
should you keep all the data except functions in your class in private section? for example: I have a std::list of integers which i need to access in other class. how would you iterate it and would you really want to keep it private? Edit: I'm looking for an individual access to each element in other class. ...
This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template, if the specialization is implicitly instantiated because it is referenced...
This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation 4.If a virtual function is implicitly instantiated, its point of instantiation is immediately following the point of instantiation of its enclosing class template specialization. 5.An explicit instantiation directive is an instantiation point for the ...
So when we need to traverse a container from start to end we write something like for (i = v->begin(); i != v->end(); i++) assuming i is an iterator for container v. My question is "what guarantees that end will always point to one past the last element in container?" How does STL ensures this behavior and is there any chance that thi...
Hi ;-) I have build a little patch to append to a certain application and trace the invocations of some functions. Among them, malloc() and open(). I am using dlsym to store the pointer to the original symbol and replace the function name with my own. It compiles -and works- perfectly under linux. Here's the code: #define _GNU_SOURCE #...
If I am creating a class with small functions that don't do much, is it acceptable to just put them all into the header file? So for a particular class, it's only just the .h with no .cpp to go with it. ...
How to use lambda expression as a template parameter? E.g. as a comparison class initializing a std::set. The following solution should work, as lambda expression merely creates an anonymous struct, which should be appropriate as a template parameter. However, a lot of errors are spawned. Code example: struct A {int x; int y;}; std::s...
This code doesn't behave how I expect it to. #include<iostream> using namespace std; class Class { Class() { cout<<"default constructor called"; } ~Class() { cout<<"destrutor called"; } }; int main() { Class object(); } I expected the output 'default constructor called', but I did not...
It just occurred to me That I don't know how to initialize a pointer to pointer from a non pointer value with one statement in C++: int a = 1; int** ppa = &&a; //Does not compile int** ppa = &(&a); //Does not compile int* pa = &a; //Works but is a int** ppa = &pa; //Two step solution Am I missing something, is the two statement the ...
Hi folks, I've been googling for a while and I no result yet so I turn to you guys ^^ I'm trying to use CMake to build my C++ project and I have a problem in the header paths. Since I'm using a lot of classes organized in several directories, all my include statements are with absolute paths (so no need to use "../../") but when try to...
I have a project where I have a lot of related Info classes and I was considering putting up a hierarchy by having a AbstractInfo class and then a bunch of derived classes, overriding the implementations of AbstractInfo as necessary. However it turns out that in C++ using the AbstractInfo class to then create one of the derived objects ...
can someone tell the difference between objective C's self and C++ this pointer? ...
hi, how to get drives letters which are available (not in use) in MFC using C++ ? Any code snippet.. ...