FUNC_ARG.LST
/* Note: compiler generated file has been edited
 * to fit magazine column.
 */

Line#  Source Line  Microsoft C Compiler Version 6.00AX

      1 /*
      2  *  func_arg.c
      3  *  Jerzy Tomasik, 20-Jul-1991
      4  *  Stack usage during function calls
      5  *  in a C program
      6  */
      7 
      8 #include <stdlib.h>
      9 #include <stdio.h>
     10 
     11 struct big_struct
     12     {
     13     char array[1024];
     14     };
     15 
     16 /*  A copy of big_struct is passed to this function
     17  *  on the stack, 1024 bytes of stack space are
     18  *  used to store the copy. The function does not
     19  *  have access to the original structure
     20  */
     21 void by_value(struct big_struct big, int dummy)
     22     {
     23     }


by_value  Local Symbols

Name          Class   Type              Size   Offset

big . . . . . param                             0004
dummy . . . . param                             0404

     24 
     25 /*  An address of big_struct is passed to this function.
     26  *  This uses only 2 bytes of stack space (under small
     27  *  memory model), but any changes to the structure
     28  *  will be reflected in the original. This is NOT
     29  *  a copy!
     30  */
     31 void by_address(struct big_struct *big, int dummy)
     32     {
     33     }

by_address  Local Symbols

Name            Class   Type              Size   Offset

big . . . . . . param                             0004
dummy . . . . . param                             0006

     34 
     35 
     36 int main(void)
     37     {
     38     struct big_struct big;
     39     int dummy;
     40 
     41     by_value(big, dummy);
     42 
     43     by_address(&big, dummy);
     44 
     45     return(0);
     46     }
     47

main  Local Symbols

Name            Class   Type              Size   Offset

dummy . . . . . auto                             -0402
big . . . . . . auto                             -0400


Global Symbols

Name            Class   Type              Size   Offset

by_address. . . global  near function      ***    0006
by_value. . . . global  near function      ***    0000
main. . . . . . global  near function      ***    000c

Code size = 004a (74)
Data size = 0000 (0)
Bss size  = 0000 (0)

