what is the difference between small memory model and large memory model?
what difference does it make when i choose 'large memory model' instead of 'small memory model' inside Turbo C compiler ?
how does that change behavior开发者_如何转开发 of my program ?
regards, essbeev.
It refers to very old concept of 16-bit memory model. 32bit & 64bit computers know nothing about these memory models.
So returning to your questions: small - declares that pointers allows you address only 64k of data or code. Pointer has length 16 bit. Entire your program is resided in single 64k segment. To explicitly address another part of memory you need explicitly declare pointer as FAR. large - declares that pointer to code or data has 32 bit, so it is FAR by default.
Hope you would not hang on these questions so long, since it is obsolete concept.
The 8086 processor has 20-bit physical addressing using a combination of 16-bit segment register and 16-bit offset. You could pack both into a 32-bit FAR
pointer, or you could asssume a default segment register and store just the lower 16 bits in a NEAR
pointer.
The difference between the small
and large
models is simply whether pointers are by default NEAR
or FAR
when not explicitly specified.
精彩评论