Redefinition of macro

When I was writing macros, I wondered whether I can overload macros. According to my C++ knowledge, you can’t. But I still hope I can do so, so I give it a try:

Read More

extern template

When you are compiling a header full of template in different places and they share the same instantation parameters, you’ll waste a lot of time compiling them. Luckily, c++11 introduce “extern template” to solve this problem.

Read More

pointer to member functions and variables

pointer to member functions

memory layout

The memory layout of member function pointers is actually a bit different from an ordinary pointer :

  1. The size of it is twice as an ordinary function pointer.
  2. And what it stores is quite different, too. When I store a normal member function in it, the first 8 bytes(a 64-bit machine) seems to be the address of that member function.
    • When a virtual member function is stored in it, it actually holds 0x1, 0, which can’t be the address of the function.
    • So I guess that, the it might be stored as if it’s a member variable pointer, it holds the offset of it, not the absolute
    • address. I defined a derived class from it and overload the virtual function, and what the pointer of it holds 0x0, 0.

      The source file for testing the features above

Read More

You're up and running!

Next you can update your site name, avatar and other options using the _config.yml file in the root of your repository (shown below).

Read More