free ((PTR) h->value.expansion);
+Further, an initial investigation indicates that pointers to functions
+returning void are okay. Thus the example given by "Calling functions
+through pointers to functions" below appears not to cause a problem.
+
String literals
---------------
+Some SGI compilers choke on the parentheses in:-
+
+const char string[] = ("A string");
+
+This is unfortunate since this is what the GNU gettext macro N_
+produces. You need to find a different way to code it.
+
K+R C did not allow concatenation of string literals like
"This is a " "single string literal".
signed keyword
--------------
-The signed keyword did not exist in K+R comilers, it was introduced in
-ISO C89, so you cannot use it. In both K+R and standard C,
+The signed keyword did not exist in K+R compilers; it was introduced
+in ISO C89, so you cannot use it. In both K+R and standard C,
unqualified char and bitfields may be signed or unsigned. There is no
way to portably declare signed chars or signed bitfields.
#define PARAMS(paramlist) () /* K+R C. */
#define VPARAMS(args) (va_alist) va_dcl
-One aspect of using K+R style function declarations, is you cannot have
-arguments whose types are char, short, or float, since without prototypes (ie,
-K+R rules), these types are promoted to int, int, and double respectively.
+One aspect of using K+R style function declarations, is you cannot
+have arguments whose types are char, short, or float, since without
+prototypes (ie, K+R rules), these types are promoted to int, int, and
+double respectively.
Calling functions through pointers to functions
-----------------------------------------------
-K+R C compilers require brackets around the dereferenced pointer
-variable. For example
+K+R C compilers require parentheses around the dereferenced function
+pointer expression in the call, whereas ISO C relaxes the syntax. For
+example
typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *));
- p->handler (pfile, p->arg);
+ *p->handler (pfile, p->arg);
needs to become
- (p->handler) (pfile, p->arg);
+ (*p->handler) (pfile, p->arg);
Macros
compilers x should not have spaces around it.
+Passing structures by value
+---------------------------
+
+Avoid passing structures by value, either to or from functions. It
+seems some K+R compilers handle this differently or not at all.
+
+
Enums
-----
Suffixes on Integer Constants
-----------------------------
-K+R C did not accept a 'u' suffix on integer constants. If you want to declare
-a constant to be be unsigned, you must use an explicit cast.
+K+R C did not accept a 'u' suffix on integer constants. If you want
+to declare a constant to be be unsigned, you must use an explicit
+cast.
-You should never use a 'l' suffix on integer constants ('L' is fine), since it
-can easily be confused with the number '1'.
+You should never use a 'l' suffix on integer constants ('L' is fine),
+since it can easily be confused with the number '1'.
Common Coding Pitfalls