Re: New developer with a couple of questions
- From: pdpi <pdpinheiro@xxxxxxxxx>
- Date: Mon, 15 Jun 2009 03:50:05 -0700 (PDT)
On Jun 15, 8:23 am, Mingos <dominikmarc...@xxxxxxxxx> wrote:
On 15 Cze, 06:52, Ray <b...@xxxxxxxxx> wrote:
Gelatinous Mutant Coconut wrote:
On Jun 14, 12:26 pm, Ray <b...@xxxxxxxxx> wrote:
Gerry Quinn wrote:
Say your map is 60x60 (typical), then you only have 3600 x 2 = 7200
pointers = 30 Kb. A trivial amount!
I get 56.25 kbytes, unless you're using "near" pointers (only 4 bytes
wide).
I thought that 32-bit systems only needed 4 byte pointers?
Oh, right. If you're still on a 32-bit system, then pointers are
indeed just four bytes.
(Say, is there an easy way to specify that "near" pointers should be
used, or does one need to code their own? Or is that an optimization
best left to the compiler?)
This isn't portable, but the "near" keyword can be used to qualify the
declaration of an automatic pointer variable, at least for one AMD
compiler. Instead of saying
actortype *killer;
you say
near actortype *killer;
and you get a four-byte pointer. But they're rarely useful because they
cannot be used in the definition of heap-allocated objects, and also
cannot be used to point to heap objects; a near pointer must be
stack-allocated and may only point at other stack-allocated locations.
Bear
I remember using the "far" keyword in a Borland compiler quite a few
years back, still in DOS, but it worked in no other compiler. IIRC,
near pointers were 16 bits long. Correct me if I'm wrong, but isn't
that a feature of Turbo C compilers only?
Mingos
The near/far specification for pointers is only applicable to
segmented architectures. How wide they are depends entirely on the
processor architecture. Compiler support is obviously a requirement as
well (the keywords are non-standard), and I'd say that unless you
actually *know* what the difference between near and far pointers is
(hint: it's not the bit width), you shouldn't be using them at all.
Just eat the extra memory consumption, and be glad you don't have to
worry about hardware details.
.
- References:
- New developer with a couple of questions
- From: tndwolf
- Re: New developer with a couple of questions
- From: Gerry Quinn
- Re: New developer with a couple of questions
- From: Ray
- Re: New developer with a couple of questions
- From: Gelatinous Mutant Coconut
- Re: New developer with a couple of questions
- From: Ray
- Re: New developer with a couple of questions
- From: Mingos
- New developer with a couple of questions
- Prev by Date: Re: Multi(dual) language support in roguelikes.
- Next by Date: Re: Multi(dual) language support in roguelikes.
- Previous by thread: Re: New developer with a couple of questions
- Next by thread: Re: New developer with a couple of questions
- Index(es):
Relevant Pages
|