This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Request for suggestions: xm-romp.h


On Sat, Mar 17, 2001 at 11:46:56AM +0000, Neil Booth wrote:
> Zack Weinberg wrote:-
> 
> > README.Portability is confused:
> 
> Ah, thanks.  Would you care to fix it?

How's this?

zw

===================================================================
Index: README.Portability
--- README.Portability	2000/07/16 13:35:23	1.6
+++ README.Portability	2001/03/18 21:48:12
@@ -46,9 +46,10 @@ 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.
+An initial investigation indicates that functions returning void, and
+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
@@ -174,17 +175,20 @@ double respectively.
 Calling functions through pointers to functions
 -----------------------------------------------
 
-K+R C compilers require parentheses around the dereferenced function
-pointer expression in the call, whereas ISO C relaxes the syntax.  For
-example
+Not all K+R C compilers permit you to call a function pointer without
+dereferencing it first.  (This is explicitly allowed by ISO C.)  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);
 
+The parentheses around the dereference expression are also necessary.
+Otherwise the * operator applies to the function's return value, not
+the function pointer.
 
 Macros
 ------
@@ -214,9 +218,11 @@ seems some K+R compilers handle this dif
 Enums
 -----
 
-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.
+In K+R C, you have to cast enum types and enum constants to use them
+as integers.  Some compilers give warnings or reject code which does
+just about anything with enum types or constants, except simple
+assignment to variables of the appropriate type, and comparisons for
+equality.
 
 
 Bitfields


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]