暗恋的滋味

暗恋以来,我的生活很幸福,每天心中都有一个人,这个人不是用来意淫的,而是用来憧憬的。憧憬着明天能够在街上碰巧遇到她,然后和她一起在微风中的晚夏夜共进晚餐,而后就是送她回家。最关键的是我回到了自己的家。这一点很重要。回哪里?回谁的家?这直接能够定义是意淫还是憧憬。

原创 const关键字的internal linkage属性收藏


     当将const关键字用于声明某个常量时,该标识符自动具备internal linkage属性,即只对相同文件内的函数可见,对其他文件中的函数是不可见的。这可以通过如下的示例程序证明

   
//const1.cpp

#include 
<iostream>

using namespace std;

const int a=1;

void funcA()
{

   cout
<<"cout int A in file const2.cpp have value of "<<a<<endl;
}


// const2.cpp

#include 
<iostream>

using namespace std;

const int a=2;
extern void funcA();
void funcB()

{

   cout
<<"cout int A in file const2.cpp have value of "<<a<<endl;
}


int main()
{

   funcA();
   funcB();
}



编译并执行

g++ const1.cpp const2.cpp
.
/a.out

输出结果

cout int A in file const2.cpp have value of 1
cout 
int A in file const2.cpp have value of 2

发表于 @ 2007年06月09日 09:37:00|评论(loading...)

新一篇: constructor的细节之处 | 旧一篇: 《Thinking in Java 4th》1~13章读书摘要

Csdn Blog version 3.1a
Copyright © Love Katherine