Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 1997 17:34:16 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        peter@spinner.DIALix.COM, phk@dk.tfs.com
Cc:        freebsd-bugs@freebsd.org, tejblum@arc.hq.cti.ru
Subject:   Re: misc/3291: md2.h, md4.h, and md5.h headers useless for c++ programms
Message-ID:  <199704150734.RAA17735@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> > > I can agree to the __BEGIN_DECLS, but the #includes do >NOT< belong here.
>> > 
>> > Why? Take a look at <stdlib.h>, for example.
>> 
>> stdlib.h is a ANSI (POSIX?) header, we have to follow the crowd on that.
>
>Headers should be self sufficient.  Converting a header that used to be 

This goes without saying :-).

>self sufficent (eg: on the 2.2 series) to one that isn't (on 3.0+) 
>is a bad move. It'll just make people more reluctant to use libmd and roll 
>their own instead.  IMHO, yes, fine, make it use __BEGIN_DECLS etc, but 
>don't break add "you must now #include <sys/cdefs.h> first even though you 
>didn't before" to it.

It is a bug for an application to #include <sys/cdefs.h>.  No section 2 or
section 3 man pages refer to it (I recently fixed a couple of references).
style.9 doesn't quite say that it is an implementation detail.

>In /usr/include, the only files that use __BEGIN_DECLS without explicitly 
>including cdefs.h first are:
>...
>mpool.h is outright broken, pthread_np.h is an extention of pthreads.h, so 
>that isn't so clear.

pthread_np.h is also missing lots of typedefs.  Clearly it is not meant to
be used by itself.

md4.h now depends on <sys/types.h> for the definition of u32_t.
This was broken when 64-bit support was fixed (md4.h previously used
`unsigned long').  This shouldn't be fixed by including <sys/types.h>,
since <sys/types.h> pollutes the namespace with select and ntoh macros
and POSIX typedefs.

md5.h includes <sys/md5.h> which has the same problem as md4.h and uglier
ifdefs.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704150734.RAA17735>