Stuff I wished I've found in some blog (and sometimes did)
Translate This Page
Translate this page
Browse by Tags
Tagged Content List
Squeezing performance out of memcmp usage
When I wrote this the other day it made me think of another thing involving the memcmp function and the VC compiler. In the code I've seen over the years where memcmp was used it was always to find out if an area was identical or not. So the code typically looked something like this: 1: if (memcmp(a...
24 Feb 2010
Exceptions or not?
I've always had mixed feelings for exceptions. First of all exceptions should only be used for exceptional things, not things that are expected. For example if you open a file it may fail for several reasons; it does not exists, you do not have rights to open it or it may be locked. These are all perfectly...
2 Oct 2009
Remember to allocate memory just in case you run out of memory
Today I read this blog post about how all .Net applications create three exceptions upon start; System.ExecutionEngineException, System.StackOverflowException and System.OutOfMemoryException. The reason is that if these are not allocated from the start, they cannot be created when they occur. This reminded...
11 Aug 2009
A reminder if you want to read/write your file in non blocking mode (in C(++))
Sometimes you might want to read a file non-blocking . It could be /dev/random because waiting for entropy might take very long. Also when you have to read device files on unix you sometimes have to read them non-blocking. A common pattern is to open the file non-blocking using the open method: open...
16 Apr 2009
Dangers of using Visual Studio 2008 Team System Code Coverage Tool for Native C++
So now you know how to get coverage reports for native C++ using Visual Studio 2008 Team System (if not - read this ). There are a few things you need to know before you get excited. First of all the only metrics you get are line and block coverage. A block is basically a statement and each line typically...
18 Nov 2008
Native C++ Code Coverage reports using Visual Studio 2008 Team System
The code coverage tool in Visual Studio 2008 Team System is quite easy to use from within the IDE unless you want code coverage for your native C++ code. In order to generate a code coverage report for native C++ you have to use the command line tools. This is how you do it: First of all your project...
16 Nov 2008
C++ pointer basics for kids
A little video to explain pointer basics in C++ to your kids... If you for some weird reason want to do that...
31 Oct 2008
Sleep does not sleep for a specified period
I recently described how you can create your own usleep method when there isn't one to use. one thing that people however tend to forget is that the sleep methods (sleep, usleep, nanosleep) only guarantees that the calling thread will be suspended for at least the given time. There is absolutely no guarantee...
22 Sep 2008
Sleep less than one millisecond
On windows you have a problem you typically never encounter on Unix. That is how to get a thread to sleep for less than one millisecond. On Unix you typically have a number of choices (sleep, usleep and nanosleep) to fit your needs. On windows however there is only Sleep with millisecond granularity...
17 Sep 2008
Mocks are not Stubs
As many before me I was recently looking at different mocking frameworks in order to find one that suited my needs, and was written in C++. And there are not many alternatives out there if you're using C++. I've found one open source and two internal (Microsoft staff can access what can be described...
22 Apr 2008
MFC is not dead
When I wrote my master's thesis was the first time I came in to contact with VC++ and MFC. I worked with MFC and VC++ quite a lot for a number of years but the last four or five years have not had much MFC work in it. When the .Net framework came along with the possibility to write managed C++ applications...
12 Apr 2008
Page 1 of 1 (11 items)
© 2015 Microsoft Corporation.
Privacy & Cookies