09.06.2013 Views

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Programming Commands <strong>XENIX</strong> Programming<br />

CC (continued)<br />

In middle, large, and huge model programs, function pointers are 32 bits long. In large<br />

and huge model programs, data pointers are 32 bits long. Programs making use of such<br />

pointers must be written carefully to avoid incorrect declaration and use of these types.<br />

lint will help to check for correct use.<br />

Keep the following in mind when programming in huge model.<br />

Objects<br />

No object can cross a segment boundary. Objects are defined as data structures<br />

that can be elements of an array, scalar objects (integers and floating point<br />

numbers), and composite obj ects (structures and unions). If the array requires<br />

three or more segments (more than 128K bytes), then the size of the objects in<br />

the array must be a power of two.<br />

Address Space<br />

When accessing a huge model array, the compiler simulates a linear address<br />

space.<br />

Array Align ment<br />

Arrays of objects requiring more than one segment are aligned so that no object<br />

crosses a 64K-byte boundary.<br />

Pointer Size<br />

Another item to be considered when programming in huge model is the value<br />

produced by sizeof(huge item) and sizeof(huge ptrl - huge ptr2). To obtain the<br />

correct value, sizeof must be type cast as a lon - -<br />

g<br />

(long)sizeof(huge item)<br />

(long)sizeof(huge =ptrl - huge _ptr2)<br />

where the value returned is a long instead of a normal integer.<br />

The -NM, -NT, and -ND options may be used with middle, large, and huge model<br />

programs to direct the text and data of specific object files to named physical<br />

segments. All text having the same text segment name is placed in a single physical<br />

segment. Similarly, all data having the same data segment name is placed in a single<br />

physical segment.<br />

Files<br />

/bin/cc, /lib/pO, /lib/pl, /lib/p2, /lib/p3<br />

See Also<br />

as, ar, ld, lint, ranlib<br />

B-26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!