长路漫漫

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

2012年8月8日

摘要: 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 阅读(828) 评论(0) 推荐(1) 编辑

2012年7月23日

摘要: 一、编译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 阅读(5262) 评论(6) 推荐(0) 编辑

2012年7月19日

摘要: 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 阅读(451) 评论(0) 推荐(0) 编辑

2012年7月17日

摘要: Linux下常用find+grep的组合来查找字符串或文件,但每次都要输入很长的命令,很是麻烦。下面的两个shell脚本类似对find+grep的组合命令的包装,可用于简单快速地从指定文件夹下查找字符串、宏定义、struct、class、typedef声明、以及查找指定文件。1、查找字符串、宏、结构体、类、typedef语句shell脚本(findstr):#! /bin/bashUsage(){ echo "Usage: ${0##*/} [option] [path] search-content" echo "[Options]:" echo &q 阅读全文
posted @ 2012-07-17 16:34 opangle 阅读(926) 评论(0) 推荐(0) 编辑

摘要: 1、目录结构如下:[root@localhost libname]# tree.+-- include¦ +-- headerA.h¦ +-- headerB.h+-- lib+-- Makefile+-- src¦ +-- cppsrcA.cpp¦ +-- cppsrcB.cpp¦ +-- csrcA.c¦ +-- csrcB.c+-- test4 directories, 7 files2、Makefile内容为:CC = gccCXX = g++AR = ar -rRM = rm -f#INSTALL ... 阅读全文
posted @ 2012-07-17 14:21 opangle 阅读(320) 评论(0) 推荐(0) 编辑