The Coder

I am a humble coder.

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  4 随笔 :: 4 文章 :: 9 评论 :: 0 Trackbacks

2006年8月11日 #

     摘要: OpenGL 中场景进行变换,要经历一些过程:视图变换 à 模型变换 à 投影变换,然后到了窗口坐标。这几个变换开始的时候把我搞很混,这几天整理一下。        一般书上把这几个变换用照相机类比,其实每个变换都是产生着一个 ...  阅读全文
posted @ 2006-08-11 22:27 TH 阅读(5853) | 评论 (8)编辑 收藏

2006年6月2日 #

下面这段引文可对左值、右值加深理解。

参考文献:《ANSI/ISO C++ Professional Programmer's Handbook》

lvalues and rvalues
An object is a contiguous region of storage. An lvalue is an expression that refers to such an object. The original
definition of lvalue referred to an object that can appear on the left-hand side of an assignment. However, const
objects are lvalues that cannot be used in the left-hand side of an assignment. Similarly, an expression that can appear
in the right-hand side of an expression (but not in the left-hand side of an expression) is an rvalue. For example

#include  < string >
using   namespace  std;
int &  f();
void  func()
{
    
int  n;
    
char  buf[ 3 ];
    n 
=   5 //  n is an lvalue; 5 is an rvalue
    buf[ 0 =   ' a ' //  buf[0] is an lvalue, 'a' is an rvalue
     string  s1  =   " a " , s2  =   " b " , s3  =    " c " //  "a", "b", "c" are rvalues
    s1  =   //  lvalue
    s2  + s3;  // s2 and s3 are lvalues that are  implicitly converted to rvalues
    s1  =   // lvalue
     string ( " z " );  // temporaries are rvalues
     int   *  p  =   new   int // p is an lvalue; 'new int' is an rvalue
    f()  =   0 // a function call that returns a reference is an lvalue
     s1.size();  // otherwise, a function call is an rvalue expression
}

An lvalue can appear in a context that requires an rvalue; in this case, the lvalue is implicitly converted to an rvalue.
An rvalue cannot be converted to an lvalue. Therefore, it is possible to use every lvalue expression in the example as
an rvalue, but not vice versa.
posted @ 2006-06-02 12:03 TH 阅读(515) | 评论 (0)编辑 收藏

2006年5月30日 #

现在有个困惑,不知道博客怎么写。既然是个专业性的博客,就不敢再这里乱写。
对博客定位的问题,我也思考数日。觉得博客可以有两个分类。
1、. 作为初学者学习的成长历程。从hello world开始。当然,至于最后能将这个历程走到哪里,却不得而知了。更甚者,不知是按部就班,一步一步学,还是心血来潮,想到哪里学哪里。
2 、 作为一个专题性的主题讨论。提出一个问题,解决它,再谈论,改进。这样的一个好处就是能对问题有清晰的认识和解决问题能力的也会提高。主题来来源可以是别人的博客上的subject,平时遇到的问题,解决问题时候出来的新问题等等。

写博克的形式,我想大致可以以上面两种。
更关心的问题是,我们在写博客的过程中能得到什么?即既得利益所得。这也同样是能否继续写下去的一个驱动力。
可以得到的,我想可以有:1、能力积累。分析、解决问题的能力。
                           2、技术积累。技术知识的扩张。
                              3、代码积累。算法、编程技巧的积淀。同时可以为创新作积累。 
            4、技术会友。有朋自远方来...  



这是我对即将开张的博客的一些想法,请多多指教。


/---------------------------------------------------------------------------------
时代有时代的主题,文章也有自己的主旨。偏离了方向,最终会被抛弃。  
-----------------------------------------------------------------------------------/

posted @ 2006-05-30 11:36 TH 阅读(354) | 评论 (0)编辑 收藏

2006年5月28日 #

大家好:
        我是TH。来自杭州,致力于C++和图形学等方面。请多多指教。
posted @ 2006-05-28 14:16 TH 阅读(295) | 评论 (1)编辑 收藏

仅列出标题