长路漫漫

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

08 2012 档案

摘要:《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)

摘要:先看一个例子:#!/bin/bashfun1(){ $1 if [ $? -ne 0 ] then echo Failed executing $1 exit 1 fi}fun2(){ echo $1# return 0 or 1}fun1 "fun2 \"that is right\""输出结果为:"that我们期待的结果应该为:that is right为什么会这样呢?实际上,例子中实际调用fun1()时,$1为fun2 \"that is right\",因此fun2()中的$1就成了"that。使用eval 阅读全文
posted @ 2012-08-24 11:05 opangle 阅读(2171) 评论(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)

摘要:【说明】:以下问题的测试环境为ubuntu-12.04-desktop-i386。1、什么是apt-get?【解答】:apt-get是一条linux命令,适用于deb包管理式的操作系统,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。apt-get命令一般需要root权限执行,所以一般跟着sudo命令。apt-get命令最常用的功能就是用来安装和卸载程序,例如: sudoapt-getinstallg++ #安装g++ sudoapt-getremoveg++#卸载g++2、安装ubuntu时没有让设置root用户密码,如何使用root账户?【解答】:(1)若是想使用ro 阅读全文
posted @ 2012-08-13 16:52 opangle 阅读(178) 评论(0) 推荐(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)