home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.dsp:3089 comp.lang.c:20173
- Newsgroups: comp.dsp,comp.lang.c
- Path: sparky!uunet!peora!tarpit!tous!bilver!dandrews
- From: dandrews@bilver.uucp (Dave Andrews)
- Subject: Re: Is this a Legal Way to Access a Specific Address?
- Organization: W. J. Vermillion - Winter Park, FL
- Date: Mon, 25 Jan 1993 15:13:08 GMT
- Message-ID: <1993Jan25.151308.29650@bilver.uucp>
- Keywords: DSP, C, ANSI, Fixed RAM
- References: <1993Jan23.042626.991@verdix.com> <1993Jan24.171455.9451@bilver.uucp> <4255@randvax.rand.org>
- Lines: 26
-
- In article <4255@randvax.rand.org> edhall@rand.org (Ed Hall) writes:
- >In article <1993Jan24.171455.9451@bilver.uucp> dandrews@bilver.uucp (Dave Andrews) writes:
- >> float *oc_ptr = (float *) ON_CHIP;
- >
- >Assignment
- >of a properly-cast integer constant (usually in hex or octal format) to
- >a pointer is not only legal, there are situations in writing device
- >drivers where it is essential. The value you state is the value you get,
- >assuming there are a sufficient number of bits. Of course, just what
- >happens when you use this pointer is highly implementation-specific.
- >But the construct itself is legal C.
-
- Ah, but is it defined that "the value you state is the value you get"?
- Or is this dependent on the implementation? I don't have a problem
- with casting integers to pointers and vice-versa, this is the sort
- of quagmire you have to get into when doing e.g. device drivers.
-
- I just was uneasy about the use of an integer as an initializer for
- a pointer that referred to a type of other than unit size. I'd feel
- better about a pointer of type void.
-
- If only I were the king of the world... <audible sigh>.
-
- - David Andrews
- dandrews@bilver.oau.org
-
-