enum element limit
Is there a maximum number of allowable enum elements in C++? (Question arose from answer to my previous question on defines) ...
Is there a maximum number of allowable enum elements in C++? (Question arose from answer to my previous question on defines) ...
I'm trying to intercept/hook the WM_PAINT message of the desktop in C++. I'm currently drawing with the desktop handle, my only problem is that I'm not in sync so it might flicker. What I basically would like is a statement where I can check on the WM_PAINT of UINT message. When this is the case, I want to do something else. I'm going ...
I have just installed the Windows SDK v7.1 (MSVC 10.0) and running my code through (almost) full warning level (W3, default for qmake's CONFIG += warn_on) and am surprised about warning C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) In the following code, stream is an std::istream and token is a std::strin...
I have designed a MIPS I simulator using Verilator which allows me to wrap verilog code into c++. I am attempting to run a c++ program on my processor but I've reached some problems. My goal is to: write a test program in c++ compile this program using a cross compiler g++ (mips-linux) take generated ELF file and disassemble it using...
Hi, I am trying to build a .dll in order to link it to one of my projects. But the build always fails : I got these messages in the output and I don't know what it means. It seems that something is missing, but I couldn't find what. I am trying to link a Mesher called Netgen http://www.hpfem.jku.at/netgen/ 1>adfront2.obj : warning LN...
Hi all, i'm looking for project suggestions that would force me to "get my hands dirty" with advanced C++ features. I'm talking about projects that would utilize the full power of the language (STL or even boost (didn't use it much yet)). Why? Because i want to learn, i want to find new challenges. At work, things start to be boring, r...
I am using MinGW which does not have full functionality. eg. It has no wchar_t stream support. I've managed to get around that by writing a mini-set of manipulators (the wcusT() in the code below).. but I find I'm getting stymied again with GetModuleFileNameEx. I have not been able to natively run GetModuleFileNameEx() This function is ...
Here is code which returns number of leading zeros from Hacker's Delight book: #include <iostream> using namespace std; int nlz(unsigned x) { int n; if (x == 0) return(32); n = 1; if ((x >> 16) == 0) {n = n +16; x = x <<16;} if ((x >> 24) == 0) {n = n + 8; x = x << 8;} if ((x >> 28) == 0) {n = n + 4; x = x << 4;} if ((x >> 30) == 0) {...
Hello! I have some shared pointer shared_ptr<T> pointer1(new T(1));. Now, in some other part of code I have an explicit copy of pointer2 (guess it would be stored in a std::map or some other container). Let's say that copy was done like map.insert(make_pair(key1, pointer1));. I am using that second copy only to precache some data and ...
The following segment demonstrates my issue: (compilation error on GCC) stringstream ss; string s; ss << "Hello"; // This fails: // s.swap(ss.str()); // This works: ss.str().swap(s); My error: constSwap.cc:14: error: no matching function for call to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::...
How does an optimizing c++ compiler determine when a stack slot of a function(part of stack frame of a function) is no longer needed by that function, so it can reuse its memory? . By stack slot I mean a part of stack frame of a function, not necessarily a whole stack frame of a function and an example to clarify the matter is, suppose w...
When using the std::map with types that use trivial, non-throwing, copy constructors, a compiler warning/error is thrown (warning level 4, release mode) for unreachable code in xtree. This is because the std::map has a try-catch in it that helps maintain the state of the tree in the case of an exception, but the compiler figures out that...
Note that the order can go either way (erase first then push back, just that this way doesn't require creating a local reference to the object). for ( GameObjItr gameObj = m_gameObjects.begin(); gameObj != m_gameObjects.end(); gameObj++ ) { if ( *gameObj && *gameObj != gameObject ) { const sf::FloatRect &otherObj = (...
Possible Duplicate: question about leading zeros As in stackoverflow.com/questions/3232534/question-about-leading-zeros. Number of trailing zeros, binary search from Hacker's Delight: #include <iostream> using namespace std; int ntz(unsigned x){ int n; if ( x==0) return 32; n=1; if ((x & 0x0000FFFF))==0) {n=n+16; x=...
Hi, I have an application that statically links with version X of a library, libfoo, from thirdparty vendor, VENDOR1. It also links with a dynamic (shared) library, libbar, from a different thirdparty vendor, VENDOR2, that statically links version Y of libfoo from VENDOR1. So libbar.so contains version Y of libfoo.a and my executable co...
Hi, I'm using the Xerces C++ DOM parser to read some XML files in a Visual C++ project. I have a class with a parse() method that is supposed to read and validate my XML source file. This is what the method looks like: #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/dom/DOM.hpp> #include <xercesc/parsers/XercesDOM...
I'm using Visual Studio 2010 to experiment with MFC. I have created a template MFC project by following the wizard. I chose a dialog based app, and unchecked other options like ActiveX controls. After making no code changes, I hit F5, and the app runs. Then, using the form designer, I drag a rich edit control from the toolbox onto th...
I am working to set up SSO for our intranet the idea is that a user would login to their workstation using their active directory username and password. Then a small application would run at login that would send some uniquely identifiable information,user name, and computers MAC address to the server were it would be entered into a data...
I'm getting the error error: 'INT32_MAX' was not declared in this scope But I have already included #include <stdint.h> I am compiling this on (g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44) with the command g++ -m64 -O3 blah.cpp Do I need to do anything else to get this to compile? or is there another C++ way to get the constant ...
The C++ Standard states the following about virtual functions that have exception specifications: If a virtual function has an exception-specification, all declarations, including the definition, of any function that overrides that virtual function in any derived class shall only allow exceptions that are allowed by the exception-spe...