pkgsrc/mk/help/c.help
rillig e874c5ae78 Explained the difference between an lvalue and an rvalue.
Documented the __STDC__ macro, especially Sun's implementation.
2008-01-10 02:34:09 +00:00

35 lines
1.4 KiB
Text

# $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)++", 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,
# a collection of "object stack macros". A patch for fixing that is in
# 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__