summaryrefslogtreecommitdiff
path: root/mk/help/c.help
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2008-01-10 02:34:09 +0000
committerrillig <rillig@pkgsrc.org>2008-01-10 02:34:09 +0000
commite874c5ae78dc10d491bbf89bd36d07bf828600c4 (patch)
treefc9538a313f2c943a0bd5594ec8c9406f531ab64 /mk/help/c.help
parent95600bc1ee874675b3dc05597c14f5c44a741361 (diff)
downloadpkgsrc-e874c5ae78dc10d491bbf89bd36d07bf828600c4.tar.gz
Explained the difference between an lvalue and an rvalue.
Documented the __STDC__ macro, especially Sun's implementation.
Diffstat (limited to 'mk/help/c.help')
-rw-r--r--mk/help/c.help23
1 files changed, 21 insertions, 2 deletions
diff --git a/mk/help/c.help b/mk/help/c.help
index a8d37b2226a..794963197ea 100644
--- a/mk/help/c.help
+++ b/mk/help/c.help
@@ -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__