Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!hybrid!robohack!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Newsgroups: comp.lang.c Subject: Re: Operations on pointers to void. Message-ID: <1990Aug12.231202.23826@druid.uucp> Date: 12 Aug 90 23:12:02 GMT References: <1990Aug9.231614.5196@basho.uucp> <1990Aug10.165644.9238@zoo.toronto.edu> <482@array.UUCP> Organization: D'Arcy Cain Consulting, West Hill, Ontario Lines: 21 In article <482@array.UUCP> colin@array.UUCP (Colin Plumb) writes: >In article <1990Aug10.165644.9238@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >> Many compilers, especially old ones with `void *' hastily kludged in, >> treat `void *' much like `char *'. That is a compiler bug. > >Actually, gcc documents its permission of pointer arithmetic on void * >as a feature. I disagree. Certainly -ansi -pedantic should complain >about the extension. I'll buy the argument about -pedantic but in general I think it is useful to be able to manipulate generic data. Things like memcpy for example. We know that the data can be any type but we want to treat it as bytes. Perhaps we need a new type which acts like void * but allows pointer arithmetic based on the smallest data type supported by the system, usually (but not always) a byte. -- D'Arcy J.M. Cain (darcy@druid) | D'Arcy Cain Consulting | MS-DOS: The Andrew Dice Clay West Hill, Ontario, Canada | of operating systems. + 416 281 6094 |