home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!princeton!csservices!kastle!blume
- From: blume@kastle.Princeton.EDU (Matthias Blume)
- Subject: Re: Pointer math (was Re: adding strings together)
- Message-ID: <1993Jan5.173245.12977@csservices.Princeton.EDU>
- Sender: news@csservices.Princeton.EDU (USENET News System)
- Reply-To: blume@kastle.Princeton.EDU (Matthias Blume)
- Organization: Dept. of Computer Science, Princeton University
- References: <1iab6dINNsq9@shelley.u.washington.edu> <C0E3Js.KIG@ocsmd.ocs.com>
- Date: Tue, 5 Jan 1993 17:32:45 GMT
- Lines: 33
-
- In article <C0E3Js.KIG@ocsmd.ocs.com>, ted@ocsmd.ocs.com (Ted Scott) writes:
- |> Benjamin Ketcham (bketcham@stein.u.washington.edu) wrote:
- |> : It's illegal to perform addition on pointers.
- |>
- |> 'Tisit? consider:
- |>
- |> char *end;
- |> char buffer_stuff[128];
- |>
- |> for(end = buffer_stuff + 128;(end > buffer_stuff && *end == ' ');end--)
- |> ; /* null loop body */ ^^^^^^^^^^
- |> better to use some index func. here
- |>
- |> Looks like addition and subtraction to me :-0
- |>
- |> : That's one of the things I like about C. It doesn't let you "just"
- |> : add two strings together, without realizing what you are doing.
- |>
- |> I contend that C will let you do alot without realizing what you're
- |> doing. You can add two string pointers together, just don't expect the
- |> result to be a concatenated string.
- |>
- |> --
- |>
- |> -Ted Scott
- |> tscott@ocsmd.ocs.com I was told that I'm a P.C. person:
- |> (301) 601-2252 Politically Challenged,
- that is.
-
- That's what I like: people who have deep knowledge and a full understanding
- of what they are posting... :-(
-
- -Matthias
-