C/C++ÖÐ×óÖµºÍÓÒÖµµÄ²î±ð
ÎÒÃdz£ËµµÄ×óÖµlvalueºÍÓÒÖµrvalue²¢²»¼òµ¥µØÒâζ×Å×óÓÒÇø±ð£¬ËüµÄÔʼ¶¨ÒåÈçÏ£º
Definition:
C and C++ have the notion of lvalues and rvalues associated with
variables and constants. The rvalue is the data value of the variable,
that is, what information it contains. The "r" in rvalue can be thought of as "read"
value
. A variable also has an associated lvalue. The "l" in lvalue can be though of as location
,
meaning that a variable has a location that data or information can be
put into. This is contrasted with a constant. A constant has some data
value, that is an rvalue. But, it cannot be written to. It does not
have an lvalue.
Another view of these terms is that objects with an rvalue, namely a
variable or a constant can appear on the right hand side of a
statement. They have some data value that can be manipulated. Only
objects with an lvalue, such as variable, can appear on the left hand
side of a statement. An object must be addressable to store a value.
Here are two examples.
int x;
x = 5; // This is fine, 5 is an rvalue, x can be an lvalue.
5 = x; // This is illegal. A literal constant such as 5 is not
// addressable. It cannot be a lvalue.
ÒýÎÄÖÐ˵: "The "r" in rvalue can be thought of as "read" value."
¾ÍÊÇÄã¿ÉÒÔ°Ñ "r" Àí½âΪ "read". ²¢Ã»ÓÐ˵¾ÍÊÇ "read" µÄÒâ˼!
lvalue, rvalue³ÆÎª"×óÖµ", "ÓÒÖµ" ²¢Ã»ÓÐÎ¥±³ÔÒâ. ÒòΪ,
µ½Ä¿Ç°ÎªÖ¹, ËùÓмÆËã»úÓïÑÔ¶¼Êǽ«±»¸³ÖµÁ¿ÖÃÓÚ¸³ÖµºÅ×ó¶ËµÄ, Òò´ËÕâÖÖ³ÆÎ½ºÍÀí½â·Ç³£Ö±¹ÛµÄ. ¶ÔÓÚ¸³ÖµÁ¿À´Ëµ, Ò²ÊÇÏàͬµÄµÀÀí.
Ö®ËùÒÔÓÐ"location"ºÍ"read"µÄ˵·¨, ÊÇÒòΪÔÚC/C++ÖÐ, Óкܶà±í´ïʽÊDZí´ï¿É¸³Öµµ¥ÔªµÄ,
ÎÒÃDz»Äܼòµ¥µØÀí½â"lvalue"¾ÍÊDZäÁ¿. Èç: a[i], *p, *(a->p+1), µÈµÈ. ÕâЩ¶¼ÊÇC/C++µÄ±í´ïʽ,
²»ÊDZäÁ¿, ¹ÊÓÃ"location"µÄº¬Òå¿ÉÒÔ±ÜÃâºÜ¶àÎó½â. Çë¿´ÏÂÃæµÄÀý×Ó:
const int x;
x = 1; // ÕâÀï x ÊÇ rvalue! ËùÒÔ, ÕâÊÇ´íÎóµÄ¸³Öµ
Ïà¹ØÎĵµ£º
C µÄ¿ªÊ¼
2010Äê2ÔÂ10ÈÕ£¬
¿ªÊ¼ÔĶÁ¼ÒÀïÓйØ"CÓïÑÔ"µÄ¸÷ÖÖ×ÊÁÏ¡£
ʹÓà TurboC2.0£¬Å¼¶û¿ÉÄÜÒ²»áÓõ½ Microsoft Visual C++ 6.0¡£ ......
1¡¢CÓïÑÔµÄÏîÄ¿ÄÚ´æ¹ÜÀíºÜÈÃÈËÍ·ÌÛ£¬×ÔʼÖÁÖÕÄãÒªÃ÷°×ÄÄЩÄÚ´æÓ¦¸ÃÒªÊÍ·Å£¬ÄÄЩµ½×îºó²ÅÄÜÊÍ·Å£¬²»È»µÄ»°£¬¾Í»á³öÏÖһЩ¶Ñ±»ÆÆ»µµÄ´íÎó
2¡¢Ã¿Ð´Ò»¸öº¯ÊýÒ»¶¨Òª¼ÇµÃдËüµÄ²âÊÔ³ÌÐò£¬²»¹ÜÄǸöº¯Êý¼òµ¥µÄ»¹ÊǸ´ÔÓ£¬²»È»µÄ»°£¬µ½×îºó»áæËÀÄ㣬ÓÐʱ»¹»á·¸Ò»Ð©µÍ¼¶µÄ´íÎó¡£Õâ¸ö½ÌѵÎҾͷ¸¹ý£¬Ð´ÁËÒ»´ó¶ÑUtility¹¤¾ßº¯Êý¿â£¬Ò»¸ö ......
µÚÒ»Õ CÓïÑÔ¸ÅÊö
²»ÒªÌÖÂÛΪʲôҪѧϰCÓïÑÔµÄÎÊÌ⣬CÓïÑÔ×ÔÓÐËü×Ô¼º¶ÀÌØµÄÆøÏ¢£¡
Ò»¡¢CÓïÑÔµÄÀúÊ·
CÓïÑÔÊÇ1972ÄêÖÁ1973Äê¼ä£¬ÔÚÃÀ¹úµÄ±´¶ûʵÑéÊÒ( Bell Laboratories )ÓÉDennis M. RitchieÒ»¸öÈË¿ª·¢³öÀ´µÄÒ»ÖÖÏà¶Ô±È½ÏеijÌÐòÉè¼ÆÓïÑÔ¡£
1960Ä꣬³öÏÖµÄALGOL 60 (Ò²³Æ A ÓïÑ ......
1¡¢C/C++³ÌÐòÔ±Çë×¢Ò⣬²»ÄÜÔÚcaseÓï¾ä²»Îª¿Õʱ“ÏòÏÂÖ´ÐД¡£
¡¡¡¡2¡¢ÖµÀàÐͺÍÒýÓÃÀàÐÍÖ®¼äµÄÇø±ð£ºC#µÄ»ù±¾ÀàÐÍ(int£¬charµÈ)¶¼ÊÇÖµÀàÐÍ£¬ÊÇÔÚÕ»Öд´½¨µÄ¡£¶ø¶ÔÏóÊÇÒýÓÃÀàÐÍ£¬´´½¨ÓÚ¶ÑÖУ¬ÐèҪʹÓùؼü×Önew¡£
¡¡¡¡3¡¢ÔÚC#ÖÐͨ¹ýʵÀý·ÃÎʾ²Ì¬·½·¨»ò³ÉÔ±±äÁ¿ÊDz»ºÏ·¨µÄ£¬»áÉú³É±àÒëÆ÷´íÎó¡£µ«ÊÇÎÒÃÇ¿ÉÒÔ ......
windows7 + ubuntu9.10Ë«Æô¶¯,Õâ¸öÓÐÌ«¶àµÄÌû×ÓÁË,²»¹ýÕâ´ÎµÄÇé¿ö±È½Ï¸´ÔÓ.
ÏÈ×°µÄWIN7,ºó×°UBUNTU,ûÓÐÈκÎÎÊÌâ.GRUBË«Æô¶¯.
ºóÀ´ÒòΪһ¸öÇé¿ö,ҪװXP,°ÑWIN7×öÁË ghost.×°ÍêXP,GRUBµ±È»Ã»ÓÐÁË,ÓÚÊÇÓÃubuntuÆô¶¯ÅÌÐÞ¸´.
ËäÈ»Æô¶¯²Ëµ¥³öÀ´ÁË,µ«Ö»ÄܽøÐÐubuntu,½øÈëwindowsµÄʱºò¾ÍÌáʾerror:cannot get C/H/S value ......