- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 C++对象 内存分布
代码如下: class T { public : T(); virtual int f(void); private : int d; };T::T(void){ d = 0x12345678;}int T::f(void){ return 12;}void x(T& t) {
2015-12-27 11:16:34 966
原创 编译器对C函数的名字修饰
假设有个文件如下:$ cat test.c int foo(int a){ return 1;}编译如下:$ g++ test.c -c $ nm test.o 00000000 T _Z3fooi可见, c++ 编译器对名字做了修饰。再编译如下:$ gcc -c test.c $ nm test.o 00000000 T foo可见,
2015-12-17 04:28:21 1338
转载 Is the type of “pointer-to-member-function” different from “pointer-to-function”?
Is the type of “pointer-to-member-function” different from “pointer-to-function”?Yep.Consider the following function:int f(char a, float b);The type of this function is different depending on
2015-12-17 04:16:11 530
转载 Name Mangling and Function Overloading
The C++ provides a feature called function overloading. This enables you to write many functions with same name, provided each function takes parameters of different types. The lower level languages (
2015-12-17 01:55:28 564
转载 Dumping a C++ object's memory layout with Clang
http://eli.thegreenplace.net/2012/12/17/dumping-a-c-objects-memory-layout-with-clangWhen one wants to understand the memory layout of structures and classes, the C/C++ operatorssizeof and offset
2015-12-13 09:26:25 904
转载 VIM Registers
It's possible to use Vim without learning about registers, but to be really productive it's worth spending some time to understand how actions and commands use them.There are several groups of regis
2015-12-10 02:32:17 751
原创 vim 和系统剪切板
1. 在 ubuntu上,默认的 vim不支持系统剪切板. 这可以在 vim 里面输入:echo has('clipboard')得到输出为0 证明。解决方法:sudo apt-get install vim-gtk安装完成后, vim 自动被设置成 gtk版本的,这个版本支持 system clipboard.2. 把 vim 里的内容拷贝到 系统剪切板:先进入 VISU
2015-12-10 02:09:11 847
转载 FindPkgConfig
a pkg-config module for CMakeUsage:pkg_check_modules( [REQUIRED] [QUIET] []*) checks for all the given modulespkg_search_module( [REQUIRED] [QUIET] []*) checks for given modul
2015-12-08 08:33:19 1951
转载 CMake and GTK+ 3: the easy way
If you look at my GitHub repositories you will notice that I’m a big fan ofCMake and I use it in all my C projects.Recently I started playing with GTK+ 3.0 but most of the official projects use th
2015-12-08 08:26:38 2175 2
原创 尝试使用google test
google test 是一个开源代码测试框架,主要用于单元测试。代码可以从https://github.com/google/googletest获得。下面以一个简单的例子来说明如何使用google test.1. 编译源代码。google test支持使用 cmake 编译和 autotools 编译。在使用后者的时候,需要先 运行 autoreconf -
2015-12-02 02:49:04 2725 1
原创 CMAKE 交叉编译
一般修改 CMAKE_SYSTEM_NAME, CMAKE_C_COMPILER 和 CMAKE_CXX_COMPILER 就够了。比如,下面的一个 CMake 的 makefile文件:######################################################################### CMake build script for Go
2015-12-02 02:12:15 2698
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人