home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.msdos.programmer:10357 comp.msdos.programmer:84 comp.os.ms-windows.programmer.tools:1337
- Path: sparky!uunet!ogicse!sequent!muncher.sequent.com!furballs
- From: furballs@sequent.com (Paul Penrod)
- Newsgroups: comp.os.msdos.programmer,comp.msdos.programmer,comp.os.ms-windows.programmer.tools
- Subject: Re: BC++ far* default in medium model
- Message-ID: <1992Nov5.084656.10427@sequent.com>
- Date: 5 Nov 92 08:46:56 GMT
- Article-I.D.: sequent.1992Nov5.084656.10427
- References: <1992Nov4.090359.21666@hellgate.utah.edu> <1992Nov5.031544.5264@sequent.com> <1992Nov5.053551.20533@emr1.emr.ca>
- Sender: usenet@sequent.com (usenet )
- Organization: Sequent Computer Systems Inc.
- Lines: 48
- Nntp-Posting-Host: crg8.sequent.com
-
- In article <1992Nov5.053551.20533@emr1.emr.ca> jagrant@emr1.emr.ca (John Grant) writes:
- >In article <1992Nov5.031544.5264@sequent.com> furballs@sequent.com (Paul Penrod) writes:
- >[stuff deleted]
- >
- >>Almost right, but you forgot something.
- >>
- >>In your data declarations, if you do not specifically specify the
- >>keyword far, then the declaration is left in the default data
- >>segment, which can be a problem if you have more than 64k of global
- >>data. Granted, DS is referenced by a far pointer, but you are still
- >>limited to 64k per data segment, eventhough you can reference upto
- >>1 megabyte of data and 1 meg of code. This is because the far
- >>pointers in the LARGE model are not normalized 32 bit, but
- >>segment:offset 20 bit pointers.
- >>
- >I am writing my first app, and I am using large model (BC++ 3.1). I haven't
- >used either 'far' or 'FAR' so far. I have just let pointers default to far as
- >provided by the large model. Ok, presumably I will eventually hit the
- >64k limit for data in my app sooner or later. What do I do then?
- >Are you saying I can get more than 64k data storage by explicitly using the
- >'far' declaration? Does that give me 'another' 64k data segment?
- >
- By explicitly declaring a variable, array, pointer, structure, etc.
- to be far the compiler forces it into another data segment, thus
- you can achieve more than 64k of TOTAL global storage by this
- method. If you want to have arrays or structures that explicity
- store > 64k of data in one instance then you have to use the HUGE
- model, which, under the Borland Compiler, makes use of 32 nit
- normalized pointers. By normalized, they mean a linear 32 bit
- address that refers to only one place in memory. Under the segment
- offset method, several variations of the segment:offset address can
- point to the exact physical location in memory.
-
- If you have the Borland C++ 3.0 or 3.1 compiler, look on page 344
- to 346 of the Programmer's Guide and it does give a good, albeit
- cursory explaination of pointers and how those versions of the
- compiler handle them and the advantages, plus drawbacks to each.
-
- Good Luck...
-
- ...Paul
-
-
- --
- --------------------------------------------------------------------
- Bureaucracy: noun, plural - Bureaucracies.
- The process of turning energy into solid waste.
- ---------------------------------------------------------------------
-