[comp.unix.questions] Where are you malloc? I loc you still. Where are you?

ARaman@massey.ac.nz (A.V. Raman) (10/03/89)

Where are you malloc?  I loc you still.  Where are you?
-------------------------------------------------------
Synopsis:
~~~~~~~~~
Why isn't malloc () declared in *.h of ucb include in a
Pyramid OSx 4.4?


Why does this happen?   (Pyramid OSx 4.4)

% cc -c temp.c
"temp.c", line 8: warning: incompatible pointers on left and right sides of =
% cat -n temp.c | head -8
     1	#include <stdio.h>
     2	#include <mp.h>
     3	
     4	test ()
     5	{
     6	   char *p;
     7	
     8	   p = malloc (BUFSIZ);
% universe
ucb
% grep lloc /usr/include/*
/usr/include/mp.h:extern short *xalloc();
% ls /usr/include | grep mem
% ls /usr/include | grep lloc
% att
% ls /usr/include | grep alloc
malloc.h
%

I think if a non-default library function is provided for general use,
it's declaration in a .h file is as important as its documentation in
the manual.  Why do I have to explicitly declare malloc, calloc and
other such things in my C source in a ucb universe, whereas I can
just include malloc.h in the att universe and have it done automatically.

-- 
/*----------------------------------------------------------------------*/
Anand Venkataraman - Systems group, Computer Center, Massey University,
Palmerston North, New Zealand
INTERNET: A.Raman@massey.ac.nz  Ph: +64-63-69099 x7943  NZ = GMT + 12

csg@pyramid.pyramid.com (Carl S. Gutekunst) (10/06/89)

In article <352@massey.ac.nz> ARaman@massey.ac.nz (A.V. Raman) writes:
>Why do I have to explicitly declare malloc, calloc and other such things in
>my C source in a ucb universe, whereas I can just include malloc.h in the att
>universe and have it done automatically.

Pyramid OSx does not declare malloc(3) in a header file in the ucb universe
because Berkeley 4.3BSD doesn't. It *is* declared in a header file in the att
universe, because AT&T SVR3 does do that. In general, it is Pyramid's policy
to not add new features to the universes that cause portability problems, even
if they would be useful or sensible.

Now, if you want to know why *Berkeley* didn't put a declaration of malloc(3)
in some convenient header file, I haven't any idea. But I agree it would be a
good idea.

<csg>