PROTO
Directive
PROTO
directive creates a prototype for an existing procedure.
A prototype declares a procedure's name and parameter list.
It allows you to call a procedure before defining it and to verify that the number and types of arguments match the procedure definition.
Create a procedure's prototype by copying the PROC
statement and making the two changes:
PROC
to PROTO
.
USES
operator if any, along with its register list.
MASM requires a prototype for each procedure called by INVOKE .
PROTO must appear first before INVOKE .
The examples show how to find the greatest common divisor (GCD) of two integers, which is the largest integer that will evenly divide both integers.
|
int GCD( int x, int y ) { x = abs( x ); y = abs( y ); do { int n = x % y; x = y; y = n; } while y > 0; return( x ); } |
Greatest Common Divisor (GCD) | |
---|---|
Without PROTO Directive
|
With PROTO Directive
|
Output | Output |