[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Low-level vs. High-level programming
- Subject: Re: Low-level vs. High-level programming
- From: wildstar <wildstar128@hotmail.com>
- Date: Wed, 25 Jun 2003 00:48:32 -0000
- Followup-to: comp.sys.cbm
- Newsgroups: comp.sys.cbm, comp.sys.apple2, rec.games.video.classic, comp.os.cpm
- Organization: Your Company
- References: <b3qo6h$5ar$1@barad-dur.nas.com> <EHrJa.16254$bH3.337@fe02.atl2.webusenet.com> <bd696r$15en$1@merope.saaf.se> <bd6g35$tte$1@barad-dur.nas.com> <bd9004$22or$1@merope.saaf.se>
- User-agent: Xnews/5.04.25
- Xref: archiver1.google.com comp.sys.cbm:59310 comp.sys.apple2:31889 rec.games.video.classic:59411 comp.os.cpm:13553
pausch@saaf.se (Paul Schlyter) wrote in
news:bd9004$22or$1@merope.saaf.se:
> In article <bd6g35$tte$1@barad-dur.nas.com>,
> White Flame \(aka David Holz\) <whiteflame52@y.a.h.o.o.com> wrote:
>
>> "Paul Schlyter" <pausch@saaf.se> wrote in message
>> news:bd696r$15en$1@merope.saaf.se...
>>> unsigned int memory_address =
>>> <address_of_memory_mapped_HW-device>;
>>
>> That's fairly ugly, and isn't guaranteed to work, since there's no
>> requirements that ints be as wide as pointers.
>
> In such a situation, use a long int instead.....
>
>> If memory_address were a void*, it would be quite kosher.
>
> Wouldn't help much, since the value of the address would still have
> to be specified as a constant, and there are no (void *) constants in
> C.
>
void* is a pointer and in C++, one may opt to use const void* instead of
void*. So I would think you are correct in this assumption. const is
used to declare something as a constant. I am not sure that you can
const a void pointer in C but in C++, you can.
White Flame, I hope you are not mixing in C++ with C. From what I
remember in C++ it is usually recommended that const void * be used
rather than void * as the type of pointer that will address a constant
value. I am sure that you know this.
Whatever the subject is about, I am sure void * would be fine to use
unless constant values are to be addressed. I think that if you are
going to take a modern approach on this that we use const void * as
implied with C++ which is C extended with object-orientation. C++ is a
superset built on C. But additional stuff with C++ will not work with C.
Though it may be accurate to say that there are some C programs that may
not work with C++.
Just noting my background in this. I may not be following this clearly
due to lack of attention on this particular subject being discussed.