长路漫漫

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  C/C++

摘要:说明:(1)转载请注明出处:http://www.cnblogs.com/opangle/p/4298155.html(2)以下以VS2013为例,并假设VC安装路径为%VC_INSTALL_PATH%(本人的安装目录为D:\Program Files (x86)\Microsoft Visual ... 阅读全文
posted @ 2015-03-27 14:14 opangle 阅读(2778) 评论(0) 推荐(3)

摘要:There are two different forms of the extern "C" declaration: extern "C" as used above, and extern "C" { … } with the declarations between the braces. The first (inline) form is a declaration with extern linkage and with C language linkage; the second only affects langua 阅读全文
posted @ 2013-06-13 10:06 opangle 阅读(394) 评论(0) 推荐(0)

摘要:1、sqlite3_open系列函数:int sqlite3_open( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb /* OUT: SQLite db handle */);int sqlite3_open16( const void *filename, /* Database filename (UTF-16) */ sqlite3 **ppDb /* OUT: SQLite db handle */);int sqlite3_open_v2(... 阅读全文
posted @ 2013-04-25 18:18 opangle 阅读(559) 评论(0) 推荐(0)

摘要:《Itanium C++ ABI》文档2.3节中描述:A pointer to data member is an offset from the base address of the class object containing it, represented as a ptrdiff_t. It has the size and alignment attributes of a ptrdiff_t. A NULL pointer is represented as -1.测试一:// test.cpp#include <iostream>#define PRINT(var 阅读全文
posted @ 2012-08-27 13:31 opangle 阅读(352) 评论(0) 推荐(0)

摘要:先看一个例子,假设有三个文件:headerA.h、headerB.h、main.cpp,其内容分别如下:// file: headerA.hstruct foo{ int member;};// file: headerB.h#include "headerA.h"// file: main.cpp#include "headerA.h"#include "headerB.h"int main(){ return 0;}其中main.cpp中直接包含了headerA.h头文件,而headerB.h中又再次包含了headerA.h,这使 阅读全文
posted @ 2012-08-22 14:39 opangle 阅读(3205) 评论(1) 推荐(0)

摘要:1、模板函数中,类型参数必须精确匹配,不支持自动(隐式)类型转换。When we call a function template such as max() for some arguments, the template parameters are determined by the arguments we pass. If we pass two ints to the parameter type T const &, the C++ compiler must conclude that T must be int. Note that no automatic type 阅读全文
posted @ 2012-08-08 15:10 opangle 阅读(908) 评论(0) 推荐(1)

摘要:一、编译llvm(同时编译compiler-rt和clang)1、下载llvm代码:svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm2、进入llvm/tools目录,下载clang编译器代码:cd llvm/toolssvn co http://llvm.org/svn/llvm-project/cfe/trunk clang3、进入llvm/projects目录,下载Compiler-RT代码:cd ../.. (back to where you started)cd llvm/projectssvn co http://llv 阅读全文
posted @ 2012-07-23 17:17 opangle 阅读(5801) 评论(6) 推荐(0)

摘要:C++中有很多绕来绕去的术语,如:指针数组、数组指针、常量指针、指针常量、函数指针、指针函数...,让人看得头晕眼花,就连new这个关键字的使用也有new operator与operator new之分(侯捷翻译的《More Effective C++》条款8中就有描述),但或许C++标准中并没有这么多拗口的术语,只是人们在使用和传播过程中“自造”了它们。其实,我觉得new-expression的使用要比new operator更贴切,也更容易与operator new区分开来,因此下文中将使用new-expression而不使用new operator一词。另外,这里有篇帖子中有关于new 阅读全文
posted @ 2012-07-19 10:35 opangle 阅读(471) 评论(0) 推荐(0)