prototypes for functions with no arguments

Alan Modra amodra@bigpond.net.au
Mon Jul 1 17:16:00 GMT 2002


On Mon, Jul 01, 2002 at 01:29:31PM -0700, Matt Kraai wrote:
> Index: gcc/README.Portability
[snip]
> + int myfunc PARAMS ((void))

Missing semicolon.  I fixed a few other coding standard violations
too.

	* README.Portability: Fix typos.

Index: gcc/README.Portability
===================================================================
RCS file: /cvs/gcc/gcc/gcc/README.Portability,v
retrieving revision 1.8
diff -u -p -r1.8 README.Portability
--- gcc/README.Portability	1 Jul 2002 20:24:40 -0000	1.8
+++ gcc/README.Portability	2 Jul 2002 00:10:42 -0000
@@ -123,8 +123,8 @@ int myfunc PARAMS ((double, int *));
 
 int
 myfunc (var1, var2)
-	double var1;
-	int *var2;
+     double var1;
+     int *var2;
 {
   ...
 }
@@ -132,7 +132,7 @@ myfunc (var1, var2)
 This implies that if the function takes no arguments, it should be
 declared and defined as follows:
 
-int myfunc PARAMS ((void))
+int myfunc PARAMS ((void));
 
 int
 myfunc ()
@@ -300,8 +300,8 @@ long and int are not the same size.
 Second, if you write a function definition with no return type at
 all:
 
-  operate(a, b)
-      int a, b;
+  operate (a, b)
+       int a, b;
   {
     ...
   }
@@ -314,8 +314,8 @@ Implicit function declarations always ha
 correct the above definition to
 
   void
-  operate(a, b)
-      int a, b;
+  operate (a, b)
+       int a, b;
   ...
 
 but operate() is called above its definition, you will get an error

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Gcc-patches mailing list