Re: confoig.h squid.h design

From: Guido Serassio <guido.serassio@dont-contact.us>
Date: Mon, 28 Apr 2008 10:27:33 +0200

Hi,

At 03:18 28/04/2008, Alex Rousskov wrote:
>On Mon, 2008-04-28 at 11:17 +1200, Amos Jeffries wrote:
> > > 1) config.h includes the autogenerated configuration file and does
> > > virtually nothing else
> > >
> > > 2) squid.h includes config.h and does virtually nothing else.
> > >
> >
> > Right. To be blunt and as simple as possible.
> >
> > Where does "squid_types.h" get included when every file in squid needs
> > "uint32_t" ??
>
>squid.h
>
>and only if every source file in squid really needs it.
>
> > THEN, where does "squid_mswin.h" get included for the same type
> > definition in windows?
>
>squid_types.h
>
>because the code should be platform-independent to the extent possible
>and should not care which platform it is being compiled on. OS-specific
>hacks should be pushed as deep down as possible so that almost nobody
>has to care about them.
>
> > (NP: mswin (rightly!) setups more than types...)
>
>Not sure what you mean, but we should have one .h file per type (or
>"concept" or related group of types).
>
> > Methinks squid_mswin.h goes in config.h and squid_types.h goes in
> > squid_mswin.h (and other OS-specifics)
>
>I think that would be wrong (but not a big deal). Universal type or
>concept trumps OS-specific hacks. The main code that needs that
>universal type should include the corresponding "universal" header (like
>squid_types.h). That header may include OS-specific hacks as needed.

squid_mswin.h is really an acrobatic trick .....
It's used only for native port, when building with MSYS+MinGW and
Microsoft Visual Studio.

For the Microsoft Visual Studio environment there is also a static
autoconf.h manually generated in the port/win32/include directory.

basically it does:
- defines some POSIX types not checked into configure
- defines some emulated POSIX functions
- provides the FD - Sockets equivalence on Windows

Please note that because the type detection in squid3 and squid2 are
different, the squid_mswin.h in squid2 is cleaner on the types side.

Maybe that some revision in squid3 type detection could help here.

Regards

Guido

-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio@acmeconsulting.it
WWW: http://www.acmeconsulting.it/
Received on Mon Apr 28 2008 - 08:28:27 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT