I'm writing some code to translate a C++ type to an appropriate type for a SQL DB. I want to identify the type, and then depending on what it is, produce the appropriate SQL code. I'm not sure exactly what can be done in this regard by using RTTI, auto, or decltype. I have some ideas but I'm not sure if they're workable.
For instance...
Today while writing some Visual C++ code I have come across something which has surprised me. It seems C++ supports ++ (increment) for bool, but not -- (decrement). It this just a random decision, of there is some reason behind this?
This compiles:
static HMODULE hMod = NULL;
static bool once = false;
if (!once++)
hMod = Load...
I have read the gSOAP docs and seen mentions of the fact that one should call soap_destroy(soap) and soap_end(soap) etc., however they are always examples with a single invocation on the service object. The service I am using returns about 40KB of text with each invocation. My problem is that memory usage grows linearly by about the same...
I'm getting "undefined reference to 'get_driver_instance'" when building even the most simple example from: http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html. It builds and runs fine on my local machine but it won’t build on the server – seems like linking mysql library issue.
This is my build cmd:
g++...
I'm using sockets with C++. The program simply requests an HTTP page, reads it into a buffer buf[512], and then displays the buffer. However pages can contain more data than the buffer, so it will cut off if there is no more space left. I can make the buffer size bigger, but that doesn't seem like a good solution. This is the code that I...
Just wondering if C++ has a standard equivalent of the Vector2/3/4 (structures I think?) in C#?
Edit: For clarification a XNA C# Vector2/3/4 "structures" (I'm not entirely sure what they are) basically hold 2, 3, or 4 float values like a struct in C++ defined as:
struct Vector3
{
float x, y, z;
};
I've been basically using just t...
What is the problem? For quite a few years I've been coding workarounds and such stuff cause I didn't know there was an "easier" or actually the normal way to do something - and I didn't ask either. Recently I've discovered plenty of can't live without stuff like templates, forward declarations and similar stuff.
Now, what I'd like is a...
Hi guys!
I am developing some COM interfaces with IDL files. Some interface methods return HRESULT, but I have checked the MIDL language reference on MSDN, there's not a clue of HRESULT. So where could I find the official definition of this data type?
Update
Thanks to Shog9, I found it in wtypes.idl. I paste it here for other's view:
...
Possible Duplicate:
How to find an item in a std::vector?
Is there something in algorithm.h which allows you to check if a std:: container contains something? Or a way to make one ex:
if(a.x == b.x && a.y == b.y)
return true;
return false;
can this only be done with std::map since it uses keys?
Thanks
...
With the new standard coming (and parts already available in some compilers).
The new type std::unique_ptr is supposed to be a replacement for std::auto_ptr.
Does their usage exactly overlap (so I can do a global find/replace on my code (not that I would do this, but if I did)) or should I be aware of some differences that are not ap...
Consider the following program. It creates a set of pointer-to-ints, and uses a custom indrect_less comparator that sorts the set by the value of the pointed-to integer. Once this is done, I then change the value of one of the pointed-to integers. Then, it can be seen the order of the set is no longer sorted (I suppose because the set...
(sizeof) char always returns 1 in 32 bit GCC compiler.
But since the basic block size in 32 bit compiler is 4, How does char occupy a single byte when the basic size is 4 bytes???
Considering the following :
struct st
{
int a;
char c;
};
sizeof(st) returns as 8 as agreed with the default block size of 4 bytes (since 2 blocks are a...
Apparently, for Cocoa applications, you're supposed to implement [[NSApp delegate] application:openFile:] or something like that to allow your application to open files double clicked in Finder.
How do you achieve this functionality using Qt, as the name of the file to be opened is not passed on the command line?
...
Hi,
We our going to start a new project in our small team:
It's a library which will be used by our other projects (in Linux and Windows).
It's not platform dependent logically (it's not using any system calls or anything like that).
It has to be compiled on various platforms (including Windows and Linux at least).
Unfortunatel...
Qt makes me question my sanity and existence. I don't know why code that works in one program that I wrote will not work in another program I wrote. The following code is identical in both programs. In P1 it works correctly by only allowing left clicks. In P2 it is exactly the same, except the left click code is does something different....
I have an application that allocates memory with 'new' and frees them with 'delete' in some parts of the code.
The problem is that whenever it exceeds the memory limit of the system (let's say 2GB), Windows sends a Kill signal to the process.
I think it is not usual since it should use the swap space(I think in windows it is called virtu...
If *get_ii() returned heap memory, rather than stack memory, would this problem be eliminated?
01 int *get_ii()
02 {
03 int ii; // Local stack variable
04 ii = 2;
05 return ⅈ
06 }
07 main()
08 {
09 int *ii;
10 ii = get_ii(); // After this call the stack is given up by the routine
11 ...
I have a program that takes an image and writes that out to a TIFF file. The image can be grey scale (8 bit), grey scale with alpha channel (16 bit), RGB (24 bit), or ARGB (32 bit). I don't have any problems writing out the images without an alpha channel, but for the images with alpha, when I try to set the extra samples tag, I get se...
Hi guys,
I'm profiling a recent program that is dominated with File read. I'm kind of confused on how to interpret the results. If someone could explain to me what these top four functions are, it would help me a lot. Thanks in advance!
% cumulative self self total
time seconds seconds calls ...
I have Visual C++ 2010 and want to install and configure Qt. How to do it?
...