Previous Topic Next topic Print topic


Call Parameters

C passes parameters, conceptually, via the stack. Parameters can be passed directly or indirectly via pointers. COBOL does not currently allow items greater than four bytes to be passed directly via the stack. It is considered bad C programming practice to pass structs or unions via the stack. If such items are greater than the size of a pointer (four bytes) it is also less efficient. The COBOL restriction will not normally cause any problem. If the Header-to-copy utility encounters such code it adds additional parameters to ensure that the stack retains its integrity.

The simple C types such as int, char, pointer are easily mapped to COBOL. When passed directly as parameters on the stack, the Header-to-copy utility generates a BY VALUE clause. But C also enables pointers to be typed as a means for indirectly passing parameters. COBOL also enables indirection, but only to one level. Where the Header-to-copy utility encounters a typed pointer, it generates a BY REFERENCE clause.

Previous Topic Next topic Print topic