Basically i just want to do an arbitrary operation using given arguments of arbitrary types.
Argument type base class is Var, and Operation is base class of the operation that will executed for given arguments.
I have Evaluator class, that hold a collection of operators which mapped using opId. Evaluator will do operation based on opId...
I have a std::vector<...> that is shared in two threads.
Both of them make calls to vec->size();
Can this be a source of race conditions? I'm hoping not since vec->size() is const.
Thanks!
...
#include <stdio.h>
int main() {
float a = 1234.5f;
printf("%d\n", a);
return 0;
}
It displays a 0!! How is that possible? What is the reasoning?
I have deliberately put a %d in the printf statement to study the behaviour of printf.
...
I have a local that's only used for the purposes of checking the result from another function and passing it on if it meets certain criteria. Most of the time, that criteria will never be met. Is there any way I can avoid this "extra" local?
I only have about 1MB of storage for my binary, and I have several thousand function calls that...
Does anybody know of a python module to parse a doxygen style C++ comment string? I mean a string like this (simple example):
/**
* A constructor.
* A more elaborate description of the constructor.
* @param param1 test1
* @param param2 test2
*/
and I would like to extract the brief, the long description, the parameter...
I am using certificate based authentication between my server and client. I have generated Root Certificate. My client at the time of installation will generate a new Certificate and use the Root Certificate to sign it. I need to use Windows API. Cannot use any windows tools like makecert.
Till now I have been able to Install the Root c...
Hi!
I have an MFC application, which i don't want to be closed during the running. I have disabled the "X" icon in the right upper corner, but now if i press the ESC key, or ALT+F4 it still closes.
How can i disable this, so it won't close, if someone press those keys? After the program has finished running i want to reenable them.
T...
I have an old C++ project and I'm having problem building it. For a certain file I receive the following kind of errors:
error: ‘atomic_t’ was not declared in this scope
And others for other identifiers like atomic_read, atomic_inc, etc. The file has an include for asm/atomic.h, but I cannot find the header file on my system. I'm u...
I am just trying to get my head around various pointer concepts and I have the following code:
char** a = new char*; // assign first pointer to point to a char pointer
char b[10] = "bla bla";
*a = new char; //assign second pointer a block of memory. -> This looks wrong to me!!
(**a) = b[2];
So what is wrong with the s...
hello, i am getting the compile error:
Error 7 error C2084: function 'Boolean
IsPointInRect(...)' already has a body
on my inline function, which is declared like this in a cpp file:
inline Boolean IsPointInRect(...)
{
...
}
i have exactly the same function in another cpp file. might this be causing the problem? how can i s...
As far as I know I can use a vector of vectors (std::vector< std::vector >) and this will be quite efficient, because internally the elements will not be copied, but swapped, which is much faster, because does not include coping of the memory buffers. Am I right?
When does std::vector exactly make use of the swap function? I can't find ...
There's a #pragma command to link in a library from the source file rather than from the project settings. I just can't seem to remember it.
Can anyone here remind me?
Thanks
...
Hi all,
we are planning to develop a device controller for a banking machine. This controller would be embedded directly on the machine, the idea is to use an off the shelf ARM board with Linux for this.
We would like to provide the API as a RESTful Web Service.
Probably we would have to separate the software on the controller in at le...
One of my project's coding guideline is
"function/variable/parameter" name should be less than or equal to 31 characters.
The project is in C++.
IMHO this guide line is not useful because
a) C++ compiler itself creates long names ( via name mangling).
b) Makes it hard to write self-documenting / expressive code.
What say ya??
...
In my application I need to calculate shifts using a pattern described in a file.
Recently, at one of my customers the application was hanging because of the following reason:
If you fill in a 'struct tm' with the exact moment at the end of the wintertime (non-DST) _mktime seems to return an incorrect result.
The code looks like this:
...
i have a 2-d vector like vector < vector < coordinates > > v( points); where coordinates class is:
class coordinate{
public :
int x;
int y;
coordinate(){
x=0;
y=0;
}
};
and points is 20.
how to sort the individual vectors v[i] based on v[i].size() , ie based on number of coordinates objects pushed ...
Hello,
I have been coding regurlarly in C++ in the past months. I am getting used to it step by step... but there are things that confuse me about formatting.
I know there is a lot of legacy from C that I supousee mixes with C++. This time I have doubts about how to order properly my members and functions within in a class. Also consid...
I have a small (6x9) graphic that I want to draw on a CButton. I have managed to get this to work using ::LoadImage and CButton::SetBitmap.
The problem is that when I put the bitmap on the button it is no-longer drawn as an 'XP style' button. I.e. it does not have rounded corners.
How can I draw a bitmap (or an icon) on a button without...
I am using Boost Spirit parser, and as the parser is parsing, semantic actions are reflected to an instance of the class ParserActions.
Here is the code for the parser (the relevant part)
struct urdf_grammar : public grammar<urdf_grammar> {
template <typename ScannerT>
struct definition {
definition(urdf_grammar const& se...
My program needs to make use of void* in order to transport data or objects in dynamic invocation situation, so that it can reference data of arbitrary types, even primitive types. However, I recently discovered that the process of down-casting these void* in case of classes with multiple base classes fails and even crashes my program af...