c++

Is there a clean way to prevent windows.h from creating a near & far macro?

Deep down in WinDef.h there's this relic from the segmented memory era: #define far #define near This obviously causes problems if you attempt to use near or near as variable names. Any clean workarounds? Other then renaming my variables? ...

What is effect of "__callback" SAL annotation?

While I certainly understand the purpose of buffer annotations, I can't see what kind of errors __callback detects. Any ideas, examples? ...

Best C/C++ Network Library

I haven't done work in C/C++ for a little bit and was just wondering what people's favorite cross platform libraries are to use. I'm looking for something that is a good quick and dirty library as well as a library that is a little more robust. Often those are two different libraries and that's okay. ...

Which I/O library do you use in your C++ code?

In new C++ code, I tend to use the C++ iostream library instead of the C stdio library. I've noticed some programmers seem to stick to stdio, insisting that it's more portable. Is this really the case? What do you use? ...

Conditional compilation for working at home

I code C++ using MS Dev Studio and I work from home two days per week. I use CVS to keep my sources synchronized between the two computers but there are difference between the environments the machines are in. Can anyone suggest a way I can conditionally modify constants in my code depending on whether I am compiling on my home box or n...

Why isn't sizeof for a struct equal to the sum of sizeof of each member?

Why does the 'sizeof' operator return a size larger for a structure than the total sizes of the structure's members? ...

How would you unittest a memory allocator?

There's a lot of people today who sell unittesting as bread-and-butter of development. That might even work for strongly algorithmically-oriented routines. However, how would you unit-test, for example, a memory allocator (think malloc()/realloc()/free()). It's not hard to produce a working (but absolutely useless) memory allocator tha...

Difference between Visual C++ 2008 and 2005

I couldn't find any useful information on Microsoft's site, so here is the question: has the compiler in Visual C++ 2008 been improved significantly since the 2005 version? I'm especially looking for better optimization. ...

Disabling Warnings generated via _CRT_SECURE_NO_DEPRECATE

What is the best way to disable the warnings generated via _CRT_SECURE_NO_DEPRECATE that allows them to be reinstated with ease and will work across Visual Studio versions? ...

MSMQ samples in C++?

Can someone give me some working examples of how you can create, add messages, read from, and destroy a private message queue from C++ APIs? I tried the MSDN pieces of code but i can't make them work properly. Thanks ...

How to setup a shared ccache

How can I setup a shared ccache without falling into a permissions problem? I would like to run a nightly or CI build with latest changes and share all created binaries throughout the R&D using a large ccache repository. ...

Any workarounds for non-static member array initialization?

In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this apart from not using arrays? [Anything that can be initialized using only the initialization list...

What is a good OO C++ wrapper for sqlite

I'd like to find a good object oriented C++ (as opposed to C) wrapper for sqlite. What do people recommend? If you have several suggestions please put them in separate replies for voting purposes. Also, please indicate whether you have any experience of the wrapper you are suggesting and how you found it to use. ...

C,C++ compiler for Vista

i need to know where i can get free version of C,C++ compilers for windows vista.many of the versions i tried are not working in fullscreen mode. ...

C++ superclass constructor calling rules

What are the C++ rules for calling the superclass constructor from a subclass one?? For example I know in Java, you must do it as the first line of the subclass constructor (and if you don't an implicit call to a no-arg super constructor is assumed - giving you a compile error if that's missing). ...

C++ usage in embedded systems

What features of C++ should be avoided in embedded systems? Please classify the answer by reason such as: memory usage code size speed portability EDIT: Lets' use an ARM7TDMI with 64k ram as a target to control the scope of the answers. ...

How to get the executable path from a Managed DLL

I have a managed DLL (written in C++/CLI) that contains a class used by a C# executable. In the constructor of the class, I need to get access to the full path of the executable referencing the DLL. In the actual app I know I can use the Application object to do this, but how can I do it from a managed DLL? ...

What does the explicit keyword in C++ mean?

Someone posted in a comment to another question about the meaning of the explicit keyword in C++. So, what does it mean? ...

What does the GDB backtrace message "0x0000000000000000 in ?? ()" mean?

What does it mean when it gives a backtrace with the following output? #0 0x00000008009c991c in pthread_testcancel () from /lib/libpthread.so.2 #1 0x00000008009b8120 in sigaction () from /lib/libpthread.so.2 #2 0x00000008009c211a in pthread_mutexattr_init () from /lib/libpthread.so.2 #3 0x0000000000000000 in ?? () The program has ...

How do you implement Coroutines in C++

I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky but solvable. Has it been done? Is it impossible? ...