When compiling in Microsoft Visual C++ you may come across the preprocessor directive NOMINMAX. This undefines the macros MIN and MAX which are specified in the windows headers. In Visual C++ v 6.0 this may be in C:\Program Files\Microsoft Visual Studio\VC98\Include\windef.h where we have
#ifndef NOMINMAX
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif #ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif /* NOMINMAX */
Using macros to do this is a bad idea, as discussed here. The standard library has templated functions std::min and std::max which are much better. Defining NOMINMAX before any #includes of windows.h prevents the macros from being defined and allows the use of the templated functions defined in algorithm.
Posted in Software | No Comments »
Software development is iterative and incremental. Therefore a critical part of building a successful production system is the build and release process. The faster we can build, test, and release, the faster we can iterate through development landmarks. This is of no use if we are not sure that everything we have done before is still working as required, which is enforced through test-driven development with automated testing. Read the rest of this entry »
Posted in Software | 1 Comment »
Using assertions is essential in defensive C++ programming. However, you want to see the filename and line number in the error, right. This leads back to using a macro, and we all know how nasty they are
All is explained in this excellent article: http://powerof2games.com/node/10
Posted in Software | No Comments »
Some functions in quantitative libraries take a long time to evaluate. If you then export this function to Excel and try to populate the arguments via the function wizard you will find that the wizard is totally unresponsive. This is because the function is reevaluated every time you enter an argument. You have to disable recalculation in the Excel function wizard, otherwise it is unuseable. To do this read this, which is implemented in xlw.
I had some linker errors, LNK2001, in Visual C++ 6.0 such as __imp__GetParent, __imp__GetClassName, and __imp__EnumWindows. This was resolved by including user32.lib in the libraries to link against.
Posted in Software | No Comments »
This algorithm by Nicholas Higham finds the nearest correlation matrix given an example matrix. It does this by alternate projections onto unit diagonal and positive semidefinite matrices. The paper can be found via: http://citeseer.ist.psu.edu/higham02computing.html Read the rest of this entry »
Posted in Software, Maths | No Comments »
Don’t install it… It has totally screwed up my installation of Visual Studio 2005 Express Edition. If you don’t have over about 4Gb free on the drive it rolls back and deletes your C runtime dll libraries.
Posted in Software | No Comments »
I have found a useful implementation of the fig drawing program in Java that is very useful if you want to do simple diagrams for LaTeX documents, but are working in a Windows environment where xfig is not readily available. Just use the Java webstart at here.
fig2dev -L pstex fig42.fig fig42.ps
fig2dev -L pstex_t -p fig42.ps fig42.fig fig42.tex
Posted in Software | No Comments »
Some our our build processes are taking longer than they should. Much of this is probably due to including too many references to different files, and not using forward class declarations wherever possible. This is well explained in C++ header file include patterns. If your library design does not take this into account your build process will get slower and slower.
Posted in Software | No Comments »
I happened to be looking for a code obfuscator for C++ and came across COBF. It is easy enough to get it working on a single file. However, when you have a large library which exports many symbols from the dll it is difficult to make a script file that can easily take an existing VC++ solution and obfuscate the entire project.
Posted in Software | No Comments »
I have just got wordpress installed. It took some help from Ruth - you have to add the user to the database after you have created it, an easy step to forget.
Posted in Software | No Comments »