What's such macro for ?
#define ValidateReadPtr(p,cb) 0 I can't think of a use case for this kind of macro,what about you? ...
#define ValidateReadPtr(p,cb) 0 I can't think of a use case for this kind of macro,what about you? ...
Hi, Given an integer array, i need to find which number occurred most number of times. I have written algorithm as below. Use a map to store number and number of times it occurred. map<int, int> Key: represents the number value: represents number of times key occurred. Scan input array and update the map with number ...
Hi all! I don't understand how to convert sRGB to CIELab and backward. Help me please. it's desirable in с++ code ...
How do breakpoints work in C++ code? Are they special instructions inserted in between some assembler instructions when the code is compiled? Or is there something else in place? Also, how are stepping-through-the-code implemented? The same way as breakpoints...? ...
Suppose I have arbitrary template method, which could receive parameters by value and by const reference (obviously, for trivial types and for objects accordingly). How is this situation handled when writing template function prototypes? I could make something like: template <typename T> void Foo(T value) { // Do something. } temp...
Hi guys, I have a little question regarding ASCII Codes. Is it possible to to find out what type of encoding is used in C++ for ASCII extended values? I want to try and find a way to decode a game animation source file without having to de-compile the game source which is not allowed. I simply want to understand whats going on in the fi...
I have a struct which indicates a trait: template<typename T> struct FooTraits { static const NEbool s_implementsFoo = false; }; And I can specialize it with a class, thus: class Apple {}; template<> struct FooTraits< Apple > { static const NEbool s_implementsFoo = true; }; However currently I cannot use FooTraits if the c...
I recently read the Head First Design Patterns book and I especially liked how the chapter on MVC seemed to bring everything together from the previous chapters. However, I am now on the verge of implementing a MVC pattern (using wxWidgets in C++) and I am beginning to realize that I don't understand threading issues as much as I should...
I found this while reading some source code. #define MACRO(x) if((void) 0, (x)); else some_func(); I don't fully understand the reasons behind that operator comma and the void cast. This has probably something to do with macro protection, I know that (void)0 is used sometimes to protect cascading elses in macros such as in if(...) t...
Hi, Can someone give me a link to a good online C++ compiler and an evaluator? I once bumped into such a site but I don't remember the name now. Thanks ...
I'm working on a homework assignment for my C++ class. The question I am working on reads as follows: Write a function that takes an unsigned short int (2 bytes) and swaps the bytes. For example, if the x = 258 ( 00000001 00000010 ) after the swap, x will be 513 ( 00000010 00000001 ). Here is my code so far: #include <iostream> u...
Hi, I am currently writing an application which simulates key press events in Mac OSX to control ioquake3. My current approach is to create the key press events with the Quartz Event Services. This works fine with e.g. TextEdit but not with ioquake3. CGKeyCode keyCode = 126; // 126 is the "up" key CGEventRef event1 = CGEventCreateKeybo...
int main() { int i = -3, j = 2, k = 0, m; m = ++i || ++j && ++k; printf("%d %d %d %d\n", i, j, k, m); return 0; } i thought that && has more precedence that || as per this logic ++j should execute, but it never does and the program outputs -2 2 0 1. What is going on here? What are the intermediate steps? ...
Hi, I'd like to create a websocket server within one of my C++ programs. Do any standalone C++ libraries exist for creating websockets or is the only option to get the WebKit or V8 sources and extract their implementation? ...
Possible Duplicate: strange output in comparision of float with float literal float a = 0.7; if (a < 0.7) ; Why does the expression here evaluate to true? ...
If I have a native C++ program and look at it's initial "Private bytes" memory counter why would it not go back down to it's original value after an object has been created and then deleted? For example if I have an application (32bit, Native C++ MFC ) that has two buttons. One in a loop that allocates 1,000,000 instances of an object ...
I use vectors a lot in my programming, and generally to traverse a vector for an existing value I use std::find as in: std::vector<int> foo; std::vector<int>::iterator pos( std::find( foo.begin(), foo.end(), bar ); This is a real bore. So I went to deriving a template from std::vector to provide a find method: template<class T> class...
Is there a way to probe the ICU library for all UChar's representing currency symbols supported by the library? My current solution is iterating through all locales and for each locale, doing something like this: const DecimalFormatSymbols *formatSymbols = formatter->getDecimalFormatSymbols(); UnicodeString currencySymbol = formatSymbo...
Ok, this is a philosophical question, and I would like to hear different opinions. If it is not a secret or trouble, please provide your age, C++ knowledge (scale 0-100, your own opinion), and the amount of years you have been, let's say, closely related to C++. For a language like C++ the existence of a standard is a must. And good com...
Hello, I'm having this weird problem. My code is simple: #include <iostream> using namespace std; int main() { int num; cout << "number: "; cin >> num; for (int i=0;num>i;i++) { cout << i <<"\n"; } system ("Pause"); return 0; } If the input for example is 1000, the output contains numbers from 7...