Basically it is a follow up of this question..
When I look into the Standard docs I found this..
In Classes 9.3,
Complete objects and member subobjects of class type shall have nonzero size.96) ...
Yeah, true.. But,
96)Base class subobjects are not so constrained.
So, when I looked into Stroustrup's FAQ, there is an example...
Im a .net developer , i have studied a course in C followed by one in C++ before as an introduction to Programming, i want to learn Qt, im not sure if it is even possible for me to start right away read a book in Qt or should i start reading a book in C++ first !
Do you think that a Senior C# developer would be able to learn Qt by readi...
Hello to all, AFAIK, we all must programming to database through database wrapper/manager such as sqliteman or CppSQLite.
But the database wrapper is specific to one type of database and this is not convenient for programmer cause require a lot of modification in case the database was cahnged.
Therefore, i would like to write a gener...
I'm having this problem with C++ classes. I would like to get pointer to myBar object and store it in quxBar. The reason is I would like to be able to check the value using quxBar->getX() but I would also like to prevent from accidentally modyfing it from Qux so I tried using Bar const*.
class Bar
{
private:
int x;
public:
void ...
I'm coding a C++ function that accepts a string, an array and the size of the array. It looks like this:
bool funcname (string skey, string sArr[], int arrSz)
I want to pass several array data types, such as double, char, long int, etc. Is it right to use string as data type for the array? Or is there a general data type that I can us...
This is the third question in the series of zero-size objects and subobjects today.
The standars clearly implies that member subobjects cannot have zero size whereas base class subobjects can.
struct X {}; //empty class, complete objects of class X have nonzero size
struct Y:X { char c; }; //Y's size may be 1
struct Z {X x; char c;};...
Linker Error:
$ make
g++ -Wall -g main.cpp SDL_Helpers.cpp Game.cpp DrawableObject.cpp `sdl-config --cflags --libs` -lSDL_mixer
/tmp/ccdxzrej.o: In function `Game':
/home/brett/Desktop/SDL/Game.cpp:16: undefined reference to `Player::Player(Game*)'
/home/brett/Desktop/SDL/Game.cpp:16: undefined reference to `Player::Player(Game*)'
colle...
Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc)
What is the difference between i = ++i; and ++i; where i is an integer with value 10?
According to me both do the same job of incrementing i i.e after completion of both the expressions i =11.
...
Hello!
Is is possible to make compilation-time Type -> Enum Series mapping?
Illustrating with an example:
Let's say, I have some Type and a enumerated value:
typedef int Type;
enum Enumerated { Enum1, Enum2, Enum3, Enum4 };
and now I somehow state the following: "let's associate Enum1 and Enum4
with type Type (don't know how to im...
Hello
In our project, we would like to access the webcam image programmatically.
The main problem we have is that the webcam automatically adjusts the sensitivity depending on the brightness of the captured image.
Is there any (platform-independent) way to change this kind of parameters for the webcam (preferably any model)?
We're cur...
Why is this code resulting in a compiler error?
#include <iostream>
#include <algorithm>
using namespace std;
class X
{
public:
void Print(int x)
{
cout << x << endl;
}
};
int main()
{
X x;
mem_fun_ref<void, X, int>(&X::Print) p;
};
Error
main.cpp:18: error: expected ; before p
...
What is the difference between specialization and instantiation in context of C++ templates. From what I have read so far the following is what I have understood about specialization and instantiation.
template <template T>
struct Struct
{
T x;
};
template<>
struct Struct <int> //specialization
{
//code
};
int main()
{
S...
__RTC_CheckEsp is a call that verifies the correctness of the esp, stack, register. It is called to ensure that the value of the esp was saved across a function call.
Anyone knows how it's implemented?
...
I got stuck with pointer to const QList of pointers to Foo. I pass pointer to myListOfFoo from Bar object to Qux. I use pointer to const to prevent making any changes outside Bar class. The problem is that I'm still able to modify ID_ executing setID in Qux::test().
#include <QtCore/QCoreApplication>
#include <QList>
#include <iostream>...
So after years of working with C# I thought it would be a good idea to write something in C++ to get my skills tuned up. It turns out they are much rustier than I could have possibly imagined. I want to create a C++ app with a UI but I do not want to use Windows Forms or WPF or anything similar to what I have been doing for a while now...
I use tag files for code completion and for a quick, inline view of parameters, overloads, files (where declared), etc. Where can I find freely available tags for the C99, C++03, and C++0x standard libraries? (C89 would be better than nothing, but I'd rather have C99.)
I prefer tags without cruft; e.g. implementations use reserved nam...
If foo is of float type, is the following expression valid/recommended?
(0.0f == foo * float(0))
Will it have the expected (mathematical) value regardless of foo's value?
Does the C++ standard defines the behavior or is it implementation specific?
...
I was coding this up in C# and the quickest solution to come to mind used the "as" or "is" keywords. I began wondering how I could implement it neatly in C++(without RTTI)... or even in C# without the aforementioned keywords.
Here is the problem (simplified):
There is a class Command which contains a stream of so called "tokens".
clas...
Dumped from visual studio:
CheckPointer(pReceivePin,E_POINTER);
017D616D cmp dword ptr [ebp+0Ch],0
017D6171 jne CBasePin::Connect+4Dh (17D617Dh)
017D6173 mov eax,80004003h
017D6178 jmp CBasePin::Connect+1A7h (17D62D7h)
But the actual definition is:
#define CheckPointer(p,ret) {if((p)==NULL)...
Is there a good way of marshalling a Dictionary<string, string> over COM interop?
Ideas so far include tokenising each KeyPair to an array of strings which can be marshalled as a SafeArray, or having two string arrays containing keys and values.
Neither seems particularly satisfactory. Any ideas?
...