genproto

Applies to C

Purpose

Produces ANSI prototypes from K&R function definitions. This should help to ease the transition from K&R to ANSI.

Syntax


Syntax Diagram

Notes

Using -qgenproto without parmnames will cause prototypes to be generated without parameter names. Parameter names are included in the prototype when parmnames is specified.

Example

For the following function, foo.c:

foo(a,b,c)
  float a;
  int *b;
  int c;

specifying

xlc -c -qgenproto foo.c

produces

int foo(double, int*, int);

The parameter names are dropped. On the other hand, specifying

xlc -c -qgenproto=parmnames foo.c

produces

int foo(double a, int* b, int c);

In this case the parameter names are kept.

Note that float a is represented as double or double a in the prototype, since ANSI states that all narrow-type arguments (such as chars, shorts, and floats) are widened before they are passed to K&R functions.

Related References

Compiler Command Line Options IBM Copyright 2003