pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/help Explained the difference between an lvalue and...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/97f4717665ba
branches:  trunk
changeset: 537510:97f4717665ba
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Jan 10 02:34:09 2008 +0000

description:
Explained the difference between an lvalue and an rvalue.

Documented the __STDC__ macro, especially Sun's implementation.

diffstat:

 mk/help/c.help |  23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 9dba0a91656e -r 97f4717665ba mk/help/c.help
--- a/mk/help/c.help    Thu Jan 10 01:57:27 2008 +0000
+++ b/mk/help/c.help    Thu Jan 10 02:34:09 2008 +0000
@@ -1,12 +1,16 @@
-# $NetBSD: c.help,v 1.1 2008/01/06 19:13:31 rillig Exp $
+# $NetBSD: c.help,v 1.2 2008/01/10 02:34:09 rillig Exp $
 
 # This file contains typical error messages from C++ compilers and
 # instructions how to fix them properly.
 
 # === Invalid lvalue in increment ===
 #
-# Once upon a time, it was possible to say "((int)foo)++". With gcc4,
+# Once upon a time, it was possible to say "((int)foo)++", which treats
+# foo as if it has type "int", and increments it. With gcc4,
 # this no longer works, and now you have to say "foo = (int)foo + 1".
+# This is because a type cast now results only in an rvalue (which is an
+# expression that doesn't have a location in memory), not in an lvalue
+# (which is an expression that does have a location).
 #
 # This becomes more complicated in macros that access datastructures,
 # which involves much pointer arithmetics. A popular example is obstack,
@@ -14,3 +18,18 @@
 # devel/coconut/patches/patch-ab revision 1.1.
 #
 # Keywords: C lvalue increment obstack obstack_ptr_grow
+
+# === The __STDC__ macro ===
+#
+# If this macro is defined to 1, the C compiler implements
+# ISO/IEC 9899:1990 (also known as C90), or a later version of that
+# standard.
+#
+# When using the Sun C compiler, there are three possibilities for the
+# __STDC__ macro:
+#
+# 1. In K&R mode (-Xt), __STDC__ is undefined.
+# 2. In default mode (-Xa), __STDC__ is defined and has the value 0.
+# 3. In conformance mode (-Xc), __STDC__ is defined and has the value 1.
+#
+# Keywords: __STDC__



Home | Main Index | Thread Index | Old Index