C/C++ Compiler (cl.hlp) (Table of Contents; Topic list)
Compact Memory Model: Details
                                             Up Contents Index Back
─────C/C++ Compiler─────────────────────────────────────────────────────────
 
     Syntax:  /AC
 
     The compact-model option allows multiple segments for program data
     but only one segment for program code.
 
     This memory model is useful for C programs with a large amount of
     data but a relatively small amount of code. Program data can
     occupy any amount of space and is given as many segments as
     needed.
 
     The defaults in compact-model programs are near code addressing
     and far data addressing. You can override the defaults with the
     __far keyword for code and the __near or __huge keyword for data.
 
     To maximize efficiency, the compiler tries to allocate static and
     initialized global data in DGROUP. The compiler allocates data
     items larger in size than the data-size threshold (set with /Gt)
     in segments outside of DGROUP. The sum of all the items smaller
     than the threshold must be less than 64K.
     See: Data Size Threshold (/Gt)
 
     Under the compact, large, or huge memory model, the compiler
     allocates initialized data items as near if they are smaller than
     or equal in size to the threshold value set by the /Gt option. The
     /Gx option extends this initialized data allocation rule to data
     that is uninitialized and data that is marked as extern. Near
     data offers two benefits:
 
        ■ The compiler can generate more efficient code to reference
          data it knows is near.
 
        ■ You can achieve multiple instances of a single windows
          application when all data is near.
 
     See: Overriding Default Addressing
          Assume That Data Is Near Option (/Gx)
 
     Using the /AC option causes CL to emit both the _M_I86 and the
     _M_I86CM preprocessor identifiers.
                                    -♦-