[TUHS] C++ / Kernel

Pete Turnbull pete at dunnington.plus.com
Fri Aug 24 20:41:36 AEST 2018


On 24/08/2018 02:41, Bakul Shah wrote:

>From what I recall {c,m,re}alloc() returned a char*, not a void *. > I don't have K&R1 handy at the moment so can't recall if void* was
> mentioned in the book (if not, that could be one reason for a lack of
> its use).

Yes, K&R1 specifically states that alloc(n) returns a char* (page 97), 
calloc(n, sizeof(obj)) returns a pointer to whatever type you specify 
(page 157), and void isn't mentioned anywhere in the book that I can see.

-- 
Pete
Pete Turnbull



More information about the TUHS mailing list