C++ unit testing with VS test professional.
Does any one know if I can test native code in VS Test 2010? ...
Does any one know if I can test native code in VS Test 2010? ...
See: http://stackoverflow.com/questions/3874615/placement-new-issue Simple question, would this solve the align problem? union { char real_array[sizeof(T)*size]; T fake_array[size]; }; ...
Say I have a class named Base and a class that derives from it called SuperBase. Given that add takes in a Base*, would either of these be valid: SuperBase *super = new SuperBase; bases.add(super); Or SuperBase *super = new SuperBase; bases.add((Base*)super); ...
I was wondering if there is a way to declare an object in c++ to prevent it from being subclassed. Is there an equivalent to declaring a final object in Java? ...
I've read some tutorials on Python metaclasses. I've never used one before, but I need one for something relatively simple and all the tutorials seem geared towards much more complex use cases. I basically want to create a template class that has some pre-specified body, but takes its base class as a parameter. Since I got the idea fr...
Okay so I would like to do some time stamping down to uS ... mS would be okay too ... but in looking into this, I am thinking What are the BEST PRACTICES when doing time stamping? My assumptions in this case are that C/C++ code is being used. I know internal clocks have various resolutions and the like ... but I am interested in things t...
I am maintaining a wxWidgets C++ application that uses EVT_CHAR_HOOK to capture key events in a high level window. I can't find any real documentation for this event but I can surmise that it intercepts key events in some way that has priority over the "standard" key events. One disturbing thing that I just discovered is that, if this...
To my understanding the representation of size_t and wchar_t are completely platform/compiler specific. For instance I have read that wchar_t on Linux is now usually 32bit, but on Windows it is 16bit. Is there any way that I can standardize these to a set size (int, long, etc.) in my own code, while still maintaining backwards comparabil...
Hi all. I have a strange error that has bothered me all day. I have a library function that I have compiled. I statically link the library to test it in a separate console application and everything builds and works ok. It is just a simple sqrt function called sqrtval at the moment. However, when I include this library in a larger graphi...
I'm making a GUI API (for games, not an OS) and would like to implement animated buttons. I'd like to be able to create timed events, but, within the class. example: class TextBox { void changeColor(int color); void createTimedEvent(func* or something, int ticks); void animate() { createTimedEvent(changeColor(red),30);...
let's assume I have some class A: header class A{ int x; int value() {return x}; }; main A a; cout << a.value(); my question is: will my compiler produce d'tor copy c'tor and operator= for me or not (cause it actually doesn't need it) EDITED does it write d'tor for me at all, cause it seems to be useless, may you give please exa...
The array has to be on the stack, and I need to modify the elements. Here is what I have: Class Me { private: int *_array; void run(){ for (int i = 0 ; i < 10; ++i) { _array[i] += 100; } } public: Me(int array[]) { _array = array; } }; This is main: int array[10] = {0, 1...
http://doc.qt.nokia.com/4.6/multimedia-videowidget.html http://doc.trolltech.com/4.2/widgets-imageviewer.html I´ve found those links above but I must say I´m not familiar with C++ at all and I could not convert to PyQt ... Would be extremely helpfull if someone could post a simple conversion code here, so I could dig into that. Thanks...
I am trying to draw a triangle using GL_POLYGON but for some reason it is taking the whole window.. ... typedef struct myTriangle { float tx; float ty; } myTriangle; std::vector<myTriangle> container; void display() { glClear(GL_COLOR_BUFFER_BIT); for(int i = 0; i < (int)container.size(); ++i) { glBegin(GL_POLYGON);...
In the class below, would this mean that onPaintCallback is NULL, or must I make it NULL in the class constructor? I want to start checking for NULL before it is given a valid pointer. class AguiWidgetBase { virtual void onPaint(); void (*onPaintCallback)(AguiRectangle clientRect) = 0; public: AguiWidgetBase(void); ~Agui...
Hi, What is the difference between these two types of pointers? As far as I can read, QSharedPointer can handle situation well, so what is the need for QSharedDataPointer? ...
Just wondering whether an object can self-destruct. Consider this situation. An object that extends a thread object. Session : Thread { Session() {} ~Session() {} ThreadMain() { while(!done){ /* do stuff ... */ ... // something sets done = true; } ~Client(); } }; void start_session() ...
Hello everyone, my question is how to send some key's to any application from application that is running in background? Let's say that I made shortcut to LEFT ARROW key which is ALT+S, and than I want whenever I'm in any application and when I press ALT+S that background application response that shortcut and send to currently opened pr...
For some reason im unable to solve this. what will be the Big-o Notation for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { c[i][j] = 0; for (int k = 0; k < n; k++) c[i][j] += a[i][k] * b[k][j]; } ...
I had to program a similar problem using goto statements. Now we are asked to rewrite our code without using goto statement. I don't know how to begin doing this program. I paste in the previous program code using the goto. // Eight Queens problem using one dimesional array and goto statement #include "stdafx.h" #include <iostream>...