OSDN Git Service

* flow.c (clear_log_links): Use free_INSN_LIST_list, not
[pf3gnuchains/gcc-fork.git] / gcc / README.Portability
index 1c2df58..d69c386 100644 (file)
@@ -46,10 +46,21 @@ should be written
 
   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".
@@ -80,8 +91,8 @@ needs to be coded in some other way.
 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.
 
@@ -155,19 +166,24 @@ ansidecl.h for the definitions of the above macros and more.
 #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.
 
 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
@@ -188,6 +204,13 @@ will stringify an argument; to get the same result on K+R and ISO
 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
 -----
 
@@ -195,6 +218,7 @@ In K+R C, you have to cast enum types to use them as integers, and
 some compilers in particular give lots of warnings for using an enum
 as an array index.
 
+
 Bitfields
 ---------
 
@@ -229,9 +253,6 @@ int is done as an unsigned comparison in K+R (since unsigned char
 promotes to unsigned) while it is signed in ISO (since all of the
 values in unsigned char fit in an int, it promotes to int).
 
-** Not having any argument whose type is a short type (char, short,
-float of any flavor) and subject to promotion. **
-
 Trigraphs
 ---------
 
@@ -243,17 +264,23 @@ them.
 Suffixes on Integer Constants
 -----------------------------
 
-**Using a 'u' suffix 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.
+
+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
+                       ======================
+
 errno
 -----
 
 errno might be declared as a macro.
 
 
-                       Common Coding Pitfalls
-                       ======================
 Implicit int
 ------------