c++

Eclipse-C++-Debugging: see content of an Array

Is it possible to see the content of a dynamically allocated array, as in: int *array = new int[dimension]; I only see the value of the pointer. edit: just found the option "display as an array", but I always have to manually enter the size of the array. Is it possible to get that automagically? ...

How many requests can SQL Server handle per second ?

I am using JMeter to test our application 's performance. but I found when I send 20 requests from JMeter, with this the reason result should be add 20 new records into the sql server, but I just find 5 new records, which means that SQL server discard the other requests(because I took a log, and make sure that the insert new records are ...

opencv multi channel elemnt access

Hi All, I'm trying to learn how to use openCV's new c++ interface. How do I access elements of a multi channel matrix. for example: Mat myMat(size(3, 3), CV_32FC2); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { //myMat_at_(i,j) = (i,j); } } What is the easiest way to do this? Something like cvSet2D...

How can I create a type based lookup table in order to implement multiple-dispatch in C++?

I'm attempting to make a messaging system in which any class derived from "Messageable" can receive messages based on how the function handleMessage() is overloaded. For example: class Messageable { public: void takeMessage(Message& message) { this->dispatchMessage(message); } prot...

Iterating over all pairs of elements in std-containers (C++)

What's the best way to iterate over all pairs of elements in std container like std::list, std::set, std::vector, etc.? Basically to do the equivalent of this, but with iterators: for (int i = 0; i < A.size()-1; i++) for(int j = i+1; j < A.size(); j++) cout << A[i] << A[j] << endl; ...

What do you think about mapmalloc ?

I found following memory profiler: http://www.solucorp.qc.ca/miscprj/mapmalloc.hc It should be light and fast. Can someone share any experience with it? ...

Is there an occassion where using catch all clause : catch (...) is justified?

Each time I have seen the catch all statement: try { // some code } catch (...) { } it has always been an abuse. The arguments against using cache all clauses are obvious. It will catch anything including OS generated exceptions such as access violations. Since the exception handler can't know what it's dealing with, in mo...

Is it OK for an abstract base class have non-abstract methods?

An abstract base class (interface class) usually has all its member functions abstract. However, I have several cases where member functions consisting of calls to the abstract methods of the interface are used. I can implement them in a derived-but-still-abstract class, or I can implemented the methods as non-abstract, non-virtual meth...

Using a C++ dll in C#

I'm attempting to consume a dll written in C++ from a C# application. I have 3rd party source code for the C++ dll (the Cyclone physics engine) and do not want to manually port it over to C#. In the C++ project I changed it to output a dll. I changed it to use the /clr flag. I changed it to use Multi-threaded Debug DLL (/MDd) because...

Is there an automated program to find C++ linker errors?

I'm working in a Linux environment with C++, using the GCC compiler. I'm currently working on modifying and upgrading a large pre-existing body of code. As part of this, it has been necessary to add quite a large number of small references throughout the code in a variety of places to link things together, and also to add in several new...

Video streaming using c++

I'm going to build an application in c++ that creates stream of photos and then sends them as video stream to another application. any ideas about how can i start? what I mean is, what libraries should i use and what the encoding? I'm thinking about MJPEG, and UDP or RTP as protocol.... any help would be greatly appreciated. ...

Pointer alignment

Hi, could anyone explain (by giving appropiate link for example) what does pointer alignment in c++ means? Thank you. ...

C# pass int and string by reference to C++ ActiveX Control: type mismatch

I have a problem passing by reference int or string variables to C++ ActiveX Control. Also I pass these variables by reference to C++ DLL and everything works fine. C++ DLL: __declspec (dllexport) void Execute (LPCTSTR cmd, int& resultCode, LPCTSTR& message, long& receiptNumber) { message = _T("ReplyProblem"); resultCode = 100...

How to check code generated by C++ compiler?

Hi, just like in topic - is there any software to open (what?) and here I don't even know what to open - file with object code or exe? My today's questions (if only todays ;)) may seem bit odd but I'm going through excersises in "The C++ Programming Language" by B.S. and sometimes I'm just stuck on particular question. I'm sometimes bit ...

Features of C++ that can't be implemented in C?

I have read that C++ is super-set of C and provide a real-time implementation by creating objects. Also C++ is closed to real world as it is enriched with Object Oriented concepts. What all concepts are there in C++ that can not be implemented in C? Some say that we can not over write methods in C then how can we have different flavo...

c++ high precision time measurement in windows

Hi, I'm interested in measuring a specific point in time down to the nanosecond using c++ in windows. Is this possible? If it isn't, is it possible to get the specific time in microseconds at least? Any library should do, unless I suppose it's possible with managed code. thanks ...

Passing pointer argument by reference under C?

#include <stdio.h> #include <stdlib.h> void getstr(char *&retstr) { char *tmp = (char *)malloc(25); strcpy(tmp, "hello,world"); retstr = tmp; } int main(void) { char *retstr; getstr(retstr); printf("%s\n", retstr); return 0; } gcc would not compile this file,but after adding #include <cstring> I could use g++ to compile this...

How to prevent window resizing temporarily?

I have a window which can be resized, but there are some situations when resizing is not possible because of the application state. Is there a way to prevent resizing the window temporarily? I want to disable resizing by all means available to the users, which include window menu, dragging edges by mouse, user initiated window tiling pe...

C/C++ maximum stack size of program

I want to do DFS on a 100 X 100 array. (Say elements of array represents graph nodes) So assuming worst case, depth of recursive function calls can go upto 10000 with each call taking upto say 20 bytes. So is it feasible means is there a possibility of stackoverflow? What is the maximum size of stack in C/C++? Please specify for gc...

How to print an integral template argument at compile time in C++

Say I have implemented a template class like this: template <size_t N> class C { void f() { // print out N here? } }; I wish that while the compiler compiles a clause like C<20> c; it would print out a message "class C is templated with N = 20" I've tried with #pragma and static_assert in vain. The pro...