随想

击鼓其镗,踊跃用兵。土国城漕,我独南行。
从孙子仲,平陈与宋。不我以归,忧心有忡。
爰居爰处?爰丧其马?于以求之?于林之下。
死生契阔,与子成说。执子之手,与子偕老。
于嗟阔兮,不我活兮。于嗟洵兮,不我信兮。
执子之手,与子共著.
执子之手,与子同眠.
执子之手,与子偕老.
执子之手,夫复何求?

又是一周过去了

纷花盛叶凝霜雪,物是人非又一年

碎碎念

幽,晨秋,凉风起,霏依旧.
虚,飞絮,势枯野,残小去.

偶遇秋天

秋天到了,秋风凉爽,就是让人有点小困困

律诗格律

五绝

注:⊙表示可平可仄
类型一
⊙平平仄仄,
⊙仄仄平平。(韵)
⊙仄平平仄,
平平仄仄平。(韵)
例诗:
山中
王勃
长江悲已滞,
万里念将归。
况属高秋晚,
山中黄叶飞。
类型二
平平仄仄平,(韵)
⊙仄仄平平。(韵)
⊙仄平平仄,
平平仄仄平。(韵)
例诗:
静夜思
李白
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。

VS bug

// assign_aTest.cpp : Defines the entry point for the console application.
//

#include “stdafx.h”

#include “boost/spirit.hpp”
#include “boost/spirit/actor/ref_actor.hpp”

using namespace boost;
using namespace boost::spirit;

#include

struct MyParser
: public grammar
{
mutable int m_i;

/// Constructor
MyParser()
{
}

/// Grammar definition
template
struct definition
{
definition(MyParser const& self)
{
test = (ch_p(L’@'))
[assign_a(self.m_i, 100)];
}

rule test;

// Start rule
rule const& start() const { return test; }
};
};

struct MyParser2
: public grammar
{
mutable int m_i;

static const int s_i = 100;

/// Constructor
MyParser2()
{
}

/// Grammar definition
template
struct definition
{
definition(MyParser2 const& self)
{
test = (ch_p(L’@'))
[assign_a(self.m_i, s_i)];
}

rule test;

// Start rule
rule const& start() const { return test; }
};
};

int _tmain(int argc, _TCHAR* argv[])
{
struct MyParser pa;
pa.m_i = 0;
parse(L”@”, pa);

struct MyParser2 pa2;
pa2.m_i = 0;
parse(L”@”, pa2);

std::cout<<"Parse1: "<<pa.m_i<<std::endl;
std::cout<<"Parse2: "<<pa2.m_i<<std::endl;

std::cin.get();
return 0;
}

VC在函数中将常数值赋给一个常引用,会导致出函数有效区域后此引用的无效,为一个不确定值。
更一般的测试例程:

// RefTst.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include
#include

using namespace std;

class A
{
private:
const int& m_i;

public:
A(const int& i)
: m_i(i)
{
}

void PrintI()
{
cout<<"I: "<<m_i<<endl;
const int* p = &m_i;
cout<<"P: "<<p<<endl;
}
};

A* GetA()
{
A* pA = new A(123456789);
pA->PrintI();
return pA;
}

void Print(A* pA)
{
int i = 54321;
__int64 j = 13328703583;
pA->PrintI();
}

int _tmain(int argc, _TCHAR* argv[])
{
A* pA = NULL;
pA = GetA();
pA->PrintI();
Print(pA);
delete pA;
cin.get();
return 0;
}

锁事–2011.7.25

一天好快又要结束了,时间总是那么静悄悄的,永远也找不到它流过的痕迹。今天的工作还比较轻松,只是晚上公司的蓝球赛要多留一个小时,好郁闷- -!。明天早上争取早点起,做班车,然后下班了去理发!、

Licensed Memory in 32-Bit Windows Vista

Licensed Memory in 32-Bit Windows Vista

Lambda vs. Function class

#define LAMBDA
#include

#ifdef LAMBDA
int main()
{
int v[10];
for (int i = 0; i < 10; ++i)
v[i] = i;

int cnt = 0;
std::for_each(v, v + 10, [&cnt](int i){
if (i % 2)
{
wprintf(L”even %d\r\n”, i);
++cnt;
}
});

return 0;
}
#else
class Func
{
public:
Func(int& i)
: _i(i)
{}

void operator()(int i)
{
if (i % 2)
{
wprintf(L”even %d\r\n”, i);
++_i;
}
}

private:
int& _i;
};

int main()
{
int v[10];
for (int i = 0; i < 10; ++i)
v[i] = i;

int cnt = 0;
std::for_each(v, v + 10, Func(cnt));

return 0;
}
#endif

看日出,等月落……

太阳缓缓的滑上地平线,再一次接替了月的工作。身影,拉的好长好长,华丽的炫盖了整片天空。
我静静坐于海边,却没有想要说出口的,就想静静的待着,那么静的待着。
总把要微笑挂在嘴边,却只会在海边勾起嘴角,默默浅笑。蔚蓝的天空下,全是一种宁静柔和,没有一丝尘的渲染,没有一处墨的污点。
虚着眼,看着海面,思想似乎飘的好远好远,飘在了哪?那不知名的角落。海面上,泛起了阵阵涟漪,将我唤回这里。看着那波光粼粼,突然间,竟觉得有些刺眼。
不带任何表情,慵懒的躺在沙滩上,缓缓闭起了眼。闲逸的沐浴着阳光,心里却微微有些苦涩,连自己也弄不清的苦涩。
不再想其他,把我的思想交给风儿,就让我的思想随风而散吧。静了,静了,静的似乎整个世界只剩下我,没有任何喧闹,或许说,是我太沉寂于自己的思维中,不想听见。我沉沉的入睡了。
等我醒来是,月亮早已升起。和太阳不同,皓月微光是静柔的,却又有些相同,都是那样没有瑕疵,没有墨点,静的那样坚不可摧。
斜眼看着海面,等待着太阳再一轮升起,再一轮落下。
也许,在未来的某一天,我会那么的怀念,怀念现在无忧无虑的看海。
现在,我只想静静坐在海边,看日出,等月落……