home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_10 / 9n10078a < prev    next >
Text File  |  1991-08-21  |  2KB  |  93 lines

  1. FUNC_ARG.LST
  2. /* Note: compiler generated file has been edited
  3.  * to fit magazine column.
  4.  */
  5.  
  6. Line#  Source Line  Microsoft C Compiler Version 6.00AX
  7.  
  8.       1 /*
  9.       2  *  func_arg.c
  10.       3  *  Jerzy Tomasik, 20-Jul-1991
  11.       4  *  Stack usage during function calls
  12.       5  *  in a C program
  13.       6  */
  14.       7 
  15.       8 #include <stdlib.h>
  16.       9 #include <stdio.h>
  17.      10 
  18.      11 struct big_struct
  19.      12     {
  20.      13     char array[1024];
  21.      14     };
  22.      15 
  23.      16 /*  A copy of big_struct is passed to this function
  24.      17  *  on the stack, 1024 bytes of stack space are
  25.      18  *  used to store the copy. The function does not
  26.      19  *  have access to the original structure
  27.      20  */
  28.      21 void by_value(struct big_struct big, int dummy)
  29.      22     {
  30.      23     }
  31.  
  32.  
  33. by_value  Local Symbols
  34.  
  35. Name          Class   Type              Size   Offset
  36.  
  37. big . . . . . param                             0004
  38. dummy . . . . param                             0404
  39.  
  40.      24 
  41.      25 /*  An address of big_struct is passed to this function.
  42.      26  *  This uses only 2 bytes of stack space (under small
  43.      27  *  memory model), but any changes to the structure
  44.      28  *  will be reflected in the original. This is NOT
  45.      29  *  a copy!
  46.      30  */
  47.      31 void by_address(struct big_struct *big, int dummy)
  48.      32     {
  49.      33     }
  50.  
  51. by_address  Local Symbols
  52.  
  53. Name            Class   Type              Size   Offset
  54.  
  55. big . . . . . . param                             0004
  56. dummy . . . . . param                             0006
  57.  
  58.      34 
  59.      35 
  60.      36 int main(void)
  61.      37     {
  62.      38     struct big_struct big;
  63.      39     int dummy;
  64.      40 
  65.      41     by_value(big, dummy);
  66.      42 
  67.      43     by_address(&big, dummy);
  68.      44 
  69.      45     return(0);
  70.      46     }
  71.      47
  72.  
  73. main  Local Symbols
  74.  
  75. Name            Class   Type              Size   Offset
  76.  
  77. dummy . . . . . auto                             -0402
  78. big . . . . . . auto                             -0400
  79.  
  80.  
  81. Global Symbols
  82.  
  83. Name            Class   Type              Size   Offset
  84.  
  85. by_address. . . global  near function      ***    0006
  86. by_value. . . . global  near function      ***    0000
  87. main. . . . . . global  near function      ***    000c
  88.  
  89. Code size = 004a (74)
  90. Data size = 0000 (0)
  91. Bss size  = 0000 (0)
  92.  
  93.