I've several writers(threads) and one reader on a stl vector.
Normal writes and reads are mutex protected, but I would like to avoid contention on a loop I have and I was wondering if vector::size would be safe enough, I suppose it depends on implementations, but since normally vector dynamic memory is for the stored items the memory wh...
I'm sure this is a pretty straight forward question. I'm writing a small windows forms app using C++/CLI. When the form initializes, I start a thread that will process some code. When the code in the thread is executed, I want the thread to somehow update the text in a statusbar in the bottom of the window. So I was thinking something li...
I'm trying to post a LVN_ ITEMCHANGED to my custom gridlist's owner. I know how to send a WM_ User message using PostMessage (as shown here)
::PostMessage( AfxGetMainWnd()->GetSafeHwnd(), WM_REFRESH, (WPARAM)pBuffer, (LPARAM)GetOutputIdx() );
When I use this same code to send a LVN_ITEMCHANGED message though,
::PostMessage( AfxGetMa...
Hello
How can I locate all old C-style cast in my source?
I'm using Visual Studio, may be there is some compilator warning that I have to enable? Or use some software tool for this?
...
What does the colon operator (":") do in this constructor? Is it equivalent to MyClass(m_classID = -1, m_userdata = 0);?
class MyClass {
public:
MyClass() : m_classID(-1), m_userdata(0) {
}
int m_classID;
void *m_userdata;
};
...
Hi
I am looking for a strcpy equivalent in Symbian. I do not wanna use the strcpy
function from stdlib.
Here is what I wanna do:
char name[128];
TBuf8 aName = _L("Test");
strncpy( name, aName.Ptr(), 127 );
*( name + MAX_FILENAME_LEN ) = 0;
So basically I wanna copy a TBuf8 to an char array. Is there a proper way to do that
in Symbi...
I have a float with the value of e.g 57.400002. I use sprintf_s to display the value on my GUI.
sprintf_s(xPosition, 19, "%f", xPositionValue);
How can I format the float so it displays as 57.40?
...
I notice the thread of similar question: http://stackoverflow.com/questions/1292/limit-size-of-queuet-in-net
That's exactly what I want to do, but I am not using .net but GNU C++. I have no reference to the base class in GNU C++, so java like super.() or .net like base.() will not work. I have been trying to inherite from queue class but...
All of the constructors methods here do the same thing. I mostly use method2 but saw method3 for the first time today. Have seen method1 in some places but dont know what are the exact differences between them ?
Which one is the best way to define constructors and why ? Is there any performance issues involved ?
1 class Test
2 {
3...
Is there any Java FAQ equivalent of the Parashift C++ FAQ lite ?
(Books like Effective Java are handy to have around, but I'm looking for a comprehensive online (advanced) Java FAQ that I could use)
...
I mean, if you use tools like NetLimiter, they let you know that a given process that connections to IP1, IP2, etc. I am using packet sniffing for my application, but I only need to packet sniff one application, so I'd like to know to what ip addresses that application is connected. Any easy way to do this? I am using a wrapper for WinPC...
One very common mistake with class hierarchies is to specify a method in a base class as being virtual, in order for all overrides in the inheritance chain to do some work, and forgetting to propagate the call on to base implementations.
Example scenario
class Container
{
public:
virtual void PrepareForInsertion(ObjectToInsert* pObje...
I am curious about both, a h single and multi-threaded implementation.
Thanks
...
Obviously we will still maintain it, but how useful will it be, once the C++ standard guarantees is.
What about synchronization primitives (Mutex, conditional variables) with advent of the new standard?
Do you consider pthread harder to master as opposed to std::thread?
...
ulong foo = 0;
ulong bar = 0UL;//this seems redundant and unnecessary. but I see it a lot.
I also see this in referencing the first element of arrays a good amount
blah = arr[0UL];//this seems silly since I don't expect the compiler to magically
//turn '0' into a signed value
Can someone provide some insight to why I...
When I try to run my program it never enters the main() function, but just hangs. Some how though, my program is throwing an exception in one of my classes as the first call in the stack after numerous calls to ntdll.dll. The exception seems to be the factor that is causing my program to hang with a "< bad ptr >". I am unable to trigg...
Hello,
I have many C/C++ old native .exe and .dll programs running on Windows servers of my company.
Some .exe programs (I will designate with E) get results on the console or into a file and most of .dll programs (D) return results in arrays of structures.
My boss has asked me for the possibility to “also” send the results generated ...
I have a situation where a boost::function and boost::bind (actually a std::tr1::function and bind) are being deleted while still in use. Is this safe? I would normally avoid it, but the offending code is a bit entrenched and my only other option is adding a new thread.
typedef function<int(int)> foo_type;
foo_type* global_foo = NULL...
I'm using Qt and C++, I need to find out the amount of memory used by instances of certain Qt classes, this is usually done using sizeof, however in Qt each class holds a pointer to an another class containing the actual implementation, the definition of this private implementation class is not found in headers but only in the source-cod...
I've been utilizing backtrace and backtrace_symbols to generate programmatic stack traces for the purposes of logging/diagnosis. It seems to roughly work, however, I'm getting a little bit of mangling and there are no accompanying file/line numbers associated with each function invocation (as I'd expect within a gdb bt call or something...