I have a C++ function which has many return statements at various places. How to set a breakpoint at the return statement where the function actually returns ?
And what does "break" command without argument means?
...
I am curious to how data is handled in the situation:
chapterlist.clear();
cScene newscene;
newscene.name = "Laura does something.";
newscene.words = 432;
newscene.pov = "Laura";
cChapter newchapter;
newchapter.scenelist.push_back(newscene);
chapterlist.push_back(newchapter);
chapterlist is a cChapter vector.
I am creating a new cSce...
hi guys, I really need help...
I have implemented a COM component (i.e A.dll) with IDL, also coded a wrapper DLL (B.dll) for that component. I have implemented required export functions for DLL "A" and registered it with "regsvr32.exe".
Problem is that I have 3 EXE files that uses B.dll to access methods of A.dll. But, I could not mana...
I have like a million records each of about 30 characters coming in over a socket. Can I read all of it into a single string? Is there a limit on the string size I can allocate?
If so, is there someway I can send data over the socket records by record and receive it record by record. I dont know the size of each record until runtime.
...
Typically Composition and Aggregation are treated the same? But they are different and the choice which one to use changes a lot?
For e.g:
I believe aggregation would be ideal for testing. But composition is not.
Maintenance of dependencies is a pain while using aggregation but less using Composition.
So are there any similar views a...
In a function, I have several consecutive for loops with the same code but different initial values for the control variable. The initial values are obtained from inputs to the function. Ie,
void thisFunction( class A a){
//some other code
for (int i = a.x; i != 0; --i){
code
}
for (int i = a.y; i != 0; --i){
code
}
...
Hi everyone! <-- Rookie C++ here again ^^
I have another theory question , as the title suggested it's to evaluate a build of code. Basically I'm considering using this template everywhere.
I am using VC++ VS2008 (all included)
Stapel.h
class Stapel
{
public:
//local vars
int x;
private:
public:
Stapel();
Stapel(...
I pulled out an application that I wrote in C++ using the sfml library, but I'm having trouble setting up the library in Eclipse. I specified the include path, the lib path and included all the necessary .so libraries to link to. the application compiles fine but it complains at runtime about missing libraries. Why is this happening? Did...
Hi,
I have a situation where I read data from a struct and keep appending it to a string so that it can be sent over a socket. When the data is fairly large, this operation is taking a lot of time. Can someone suggest any alternatives?
I have a structure
struct fileInfo
{
int file_id;
char filename[16];
double ...
Hi,
I need to call "C" function which is having one argument variable "struct" (which is defined in "C" file), from "C++" file.
I used 'extern "C"', but getting linking error.
Please suggest me some way to do it ?
Thanks
Priyanshu
...
Hello,
I am quite new to real use of templates, so I have the following design question.
I am designing classes Bunch2d and Bunch4d that derive from a abstract base class Bunch:
class Bunch {virtual void create()=0;};
class Bunch2d : public Bunch {void create();};
class Bunch4d : public Bunch {void create();};
The class Bunch will c...
A coworker routinely writes something like this:
::someObject->someMethod(anAttribute, anotherAttribute);
someObject is a global variable.
Those two colons seem strange to me. The code compiles and runs just fine without them.
The coworker claims that those colons make someObject explicitly global and thus prevent confusion with a po...
Hi,
I have a multi-threaded C++ application.
Now I know that for global shared variables, you should use volatile in some cases while checking the state of the variable or else the compiler could assume that the variable's value never changes (in that thread).
What if, however, instead of checking the status of a variable I call a...
How can I move elements in an array to the next element
eg: x[5] = { 5, 4, 3, 2, 1 }; // initial values
x[0] = 6; // new values to be shifted
x[5] = { 6, 5, 4, 3, 2 }; // shifted array, it need to be shifted,
// not just increment the values.
This what I've done so far. It's wrong, that's why I n...
Hey,
How do I implement a save and load dialogue box into my current project? I only need to know how change the basics, like the filename mask and default path.
Any help appreciated, or even a link to a helpful website.
Thanks.
...
Hello
According to
http://stackoverflow.com/questions/115703/storing-c-template-function-definitions-in-a-cpp-file
it is easy to seprate the interface and the implementation of a template class,
.h file
template<typename T>
class foo
{
public:
foo();
~foo();
void do(const T& t);
};
.cpp file
template <ty...
How can I perform endian conversion on vector of structs?
For example:
struct TestStruct
{
int nSomeNumber;
char sSomeString[512];
};
std::vector<TestStruct> vTestVector;
I know how to swap int values, but how to swap a whole vector of custom structs?
...
In A.h I have the following class
class A
{
int a;
char name[100];
}
B.h has the following code
class A;
Class B
{
public:
int c;
float d;
getObjectDetails(A *);
};
I compiled it as g++ A.h B.h B.cpp -o out. But it gives compilation errors saying class A is incomplete. Could any one please help me understand?
Also, ...
I've seen people use a trailing underscore for member variables in classes, for instance in the renowned C++ FAQ Lite.
I think that it's purpose is not to mark variables as members, that's what "m_" is for. It's actual purpose is to make it possible to have an accessor method named like the field, like this:
class Foo {
public:
bar...
Hi,
I create a .net custom usercontrol to be used in COM through Borland C++ Builder.
1) i implement an explicit interface and decorate it with some attributes (ComVisibleAttribute, GuidAttribute and InterfaceTypeAttribute). This interface has 3 properties just to try, each property has a DispIdAttribute.
`namespace SimpleCOMServer{
[...