home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!email!hp
- From: hp@vmars.tuwien.ac.at (Peter Holzer)
- Subject: Re: Why should POINTERS be so damn hard to understand ?
- Message-ID: <1992Aug27.181844.11739@email.tuwien.ac.at>
- Sender: news@email.tuwien.ac.at
- Nntp-Posting-Host: quasi.vmars.tuwien.ac.at
- Organization: Technical University Vienna, Dept. for Realtime Systems, AUSTRIA
- References: <l9nl34INNhln@almaak.usc.edu> <25233@castle.ed.ac.uk> <1992Aug27.135946.6622@infonode.ingr.com> <17islrINNh6c@early-bird.think.com>
- Date: Thu, 27 Aug 1992 18:18:44 GMT
- Lines: 19
-
- barmar@think.com (Barry Margolin) writes:
-
- >for (_i=(char *)a; _i<a+1000*sizeof(int); _i+=sizeof(int))
- > *(int *)_i = whatever();
-
- >I would epect this to produce almost identical code. And in a language
- >where pointers weren't typed, you wouldn't need all the casting.
-
- You would still have to cast _i to (int *), or the compiler couldn't
- know how much memory it should access (1 byte? 1 word? ...)
-
- Anyway, why should I type sizeof(int), when the compiler can do it for
- me?
-
- --
- | _ | Peter J. Holzer | Think of it |
- | |_|_) | Technical University Vienna | as evolution |
- | | | | Dept. for Real-Time Systems | in action! |
- | __/ | hp@vmars.tuwien.ac.at | Tony Rand |
-