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.
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 weird 20 bits addressing using a combination of 16 bits segment registers and 16 bits offsets. To simplify this, you could pack both in a 32 bits FAR
pointer, or you could asssume a default segmet 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
if not explicitly specified.