When it is amoral... (Re: When is a cast not a cast?)

David T. Sandberg dts at quad.uucp
Sun May 7 02:52:56 AEST 1989


In article <4093 at ficc.uu.net> peter at ficc.uu.net (Peter da Silva) writes:
>In article <563 at lzaz.ATT.COM>, hutch at lzaz.ATT.COM (R.HUTCHISON) writes:
>> 	midpoint_pointer = (start_pointer + end_pointer) / 2;
>
>You're right. It's a valid operation.

It is?  What about when the difference between the two is an odd
number of multibyte units?  Writing to *midpoint_pointer after
setting it up in such a fashion is going to corrupt some data
(unless, of course, you *want* to modify the last byte(s) of one
unit and the first byte(s) of the next ;')

>(what's the average of the 7 clubs and the 9 clubs?)

More to the point, what's the difference between the 7 clubs and the
8 clubs?

Perhaps you mean that it is an *allowed* operation, without regards
to the wisdom of same.  Or perhaps you guys are only talking about
char pointers (and then what happens if you run into a multibyte char
machine?).

-- 
  char *david_sandberg()
  {
      return ( dts at quad.uucp || uunet!rosevax!sialis!quad!dts );
  }



More information about the Comp.lang.c mailing list