OSDN Git Service

* gcc.c-torture/execute/ieee/rbug.x: XFAIL FreeBSD 5.x.
[pf3gnuchains/gcc-fork.git] / gcc / README.Portability
index d6c8aec..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,22 +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.
+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
@@ -191,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
 -----
 
@@ -244,11 +264,12 @@ them.
 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