malloc.h is still legitimate after all

pfgshield-freebsd at yahoo.com pfgshield-freebsd at yahoo.com
Tue Feb 21 10:49:49 PST 2006


Hi;
I was porting some parts of COIN-OR (some Operations Research packages
opensourced by IBM a while ago), and when I was happily suggesting that all
occurences of malloc.h should be removed and/or replaced with stdlib.h I got
this reply:
______________
Pedro, 

The mallinfo struct that ReportMemory uses is defined in malloc.h, and not
brought in by stdlib.h. 

I'm testing on AIXv5.1, __STDC__ is defined, and "struct mallinfo" is unknown
if I don't include malloc.h. 

I don't know enough about the different flavors of UNIX (System V, POSIX, BSD?)
to know what to do that satisfies all. 

The AIX docs say 

  "The mallopt and mallinfo subroutines are provided for source-level
compatibility with the System V malloc subroutine " 

The gnu gcc docs say 

"This function and its associated data type are declared in `malloc.h'; they
are an extension of the standard SVID/XPG version." 
...
___________

So malloc.h will no be removed from the package but rather it will be undef'd
__FreeBSD__ and the package will still work on FreeBSD. I doubt we will ever
add these extensions, but there's also a glibc port for FreeBSD now so maybe
__FreeBSD__ is not the correct variable here.

I personally think the FreeBSD port's people have contributed greatly to clean
inappropiate uses of malloc.h in the software world, but perhaps an error is
too drastic and we should fall back to a warning.

cheers,

    Pedro.


---
     Pedro F. Giffuni
     M. Sc. Industrial Eng. University of Pittsburgh
     Mech. Eng.      Universidad Nacional de Colombia
---
Yahoo is powered by FreeBSD    http://www.FreeBSD.org/


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it


More information about the freebsd-standards mailing list