The Software Purist |

Archive for April 2013

Apr/13

17

Forgotten C++ Macros

The joys of exploring the depths of C++. So, I was looking at the assert macro and I completely forgot about one of the macros it makes use of. It seems we commonly make use of __FILE__, __LINE__, __FUNCTION__, etc… But I completely forgot about __BASE_FILE__. This actually gives you the compilation unit, rather than the file that got included. This is pretty helpful, actually. Here’s a reference for the standard C++ macros:

I think I may make use of __BASE_FILE__ more often.

No tags

Apr/13

2

C++11 Move Constructors

Here’s a good article describing how the new C++11 feature for move constructors works. I’m putting together a demo application that will turn into a blog post later.

http://www.cprogramming.com/c++11/rvalue-references-and-move-semantics-in-c++11.html

I like this new feature as it seems it will be very valuable in avoiding some annoying cases where you would otherwise do unnecessary copying. Will be interesting to see how easy it is to implement this performance improvement in practice.

No tags

Theme Design by devolux.nh2.me