Re: two xasserts in squid3

2008-02-11 Thread Alex Rousskov
On Mon, 2008-02-11 at 12:18 +0900, Adrian Chadd wrote: On Mon, Feb 11, 2008, Amos Jeffries wrote: That only because none has shown me a better way to do function pointers than the way squid currently does them. I'm pretty sure the async calls stuff has an implementation of this. There's

Re: two xasserts in squid3

2008-02-11 Thread Alex Rousskov
On Mon, 2008-02-11 at 10:15 +1300, Amos Jeffries wrote: I think a better approach to this would be: 1) do we actually need it anyway? Yes, we need a common assert-like macro. 2) where is it supposed to be defined? IMO: include/xassert.h if xassert is used outside of src/ src/xassert.h

Re: two xasserts in squid3

2008-02-11 Thread Robert Collins
On Tue, 2008-02-12 at 11:10 +1300, Amos Jeffries wrote: On Mon, 2008-02-11 at 09:33 +1100, Robert Collins wrote: One of the things I'd most love to see is the modularisation completed - complete deletion of protos.h, structs.h, typedefs.h. Yes, of course. That would be the focus of the

Re: two xasserts in squid3

2008-02-11 Thread Amos Jeffries
On Tue, 2008-02-12 at 10:37 +1300, Amos Jeffries wrote: When we get a better VCS, we should discuss moving include/ and lib/ stuff into src/ with the exception of 3rd party code. This would avoid problems created by that artificial boundary. What I have been mulling over after seeing code

Re: two xasserts in squid3

2008-02-11 Thread Amos Jeffries
On Mon, 2008-02-11 at 10:15 +1300, Amos Jeffries wrote: I think a better approach to this would be: 1) do we actually need it anyway? Yes, we need a common assert-like macro. 2) where is it supposed to be defined? IMO: include/xassert.h if xassert is used outside of src/

Re: two xasserts in squid3

2008-02-11 Thread Amos Jeffries
On Sun, 2008-02-10 at 20:51 +0200, Tsantilas Christos wrote: Maybe it was better if the files lib/assert.c and include/assert.h removed and the assert macro defined in squid.h file like squid2.6 does... It looks like Array, MemPool, and splay files are using assert outside of src/ so you

Re: two xasserts in squid3

2008-02-11 Thread Amos Jeffries
Alex Rousskov wrote: On Sun, 2008-02-10 at 20:51 +0200, Tsantilas Christos wrote: Maybe it was better if the files lib/assert.c and include/assert.h removed and the assert macro defined in squid.h file like squid2.6 does... It looks like Array, MemPool, and splay files are using assert

Re: two xasserts in squid3

2008-02-11 Thread Tsantilas Christos
Alex Rousskov wrote: On Sun, 2008-02-10 at 20:51 +0200, Tsantilas Christos wrote: Maybe it was better if the files lib/assert.c and include/assert.h removed and the assert macro defined in squid.h file like squid2.6 does... It looks like Array, MemPool, and splay files are using assert

Re: two xasserts in squid3

2008-02-11 Thread Alex Rousskov
On Sun, 2008-02-10 at 20:51 +0200, Tsantilas Christos wrote: Maybe it was better if the files lib/assert.c and include/assert.h removed and the assert macro defined in squid.h file like squid2.6 does... It looks like Array, MemPool, and splay files are using assert outside of src/ so you

Re: two xasserts in squid3

2008-02-11 Thread Alex Rousskov
On Mon, 2008-02-11 at 09:33 +1100, Robert Collins wrote: One of the things I'd most love to see is the modularisation completed - complete deletion of protos.h, structs.h, typedefs.h. Yes, of course. That would be the focus of the cleanup that Amos is volunteering to do :-) Alex.

Re: two xasserts in squid3

2008-02-11 Thread Alex Rousskov
On Tue, 2008-02-12 at 11:27 +1300, Amos Jeffries wrote: * Add automatic testing for header dependency - script to perform universal include unit-test for .h files - link to automatic unit-testing in each directory - fix the compile errors! I am thinking along

Re: two xasserts in squid3

2008-02-11 Thread Amos Jeffries
On Tue, 2008-02-12 at 11:10 +1300, Amos Jeffries wrote: On Mon, 2008-02-11 at 09:33 +1100, Robert Collins wrote: One of the things I'd most love to see is the modularisation completed - complete deletion of protos.h, structs.h, typedefs.h. Yes, of course. That would be the focus of

two xasserts in squid3

2008-02-10 Thread Tsantilas Christos
Hi all, There is something which confuse me. The xassert function implemented in squid3 in two places, in the file src/debug.cc and in the lib/assert.c file. Also the assert macro declared in src/Debug.h file and in the include/assert.h file. Is there any reason for these two implementations

Re: two xasserts in squid3

2008-02-10 Thread Amos Jeffries
Hi all, There is something which confuse me. The xassert function implemented in squid3 in two places, in the file src/debug.cc and in the lib/assert.c file. Also the assert macro declared in src/Debug.h file and in the include/assert.h file. Is there any reason for these two

Re: two xasserts in squid3

2008-02-10 Thread Robert Collins
On Mon, 2008-02-11 at 10:15 +1300, Amos Jeffries wrote: What I'm seeing with the auto-docs work is that a lot of header files include squid.h or protos.h for one or two simple things. That file brings with it a host of type-dependencies, directly or indirectly that clutter up the whole

Re: two xasserts in squid3

2008-02-10 Thread Amos Jeffries
On Mon, 2008-02-11 at 10:15 +1300, Amos Jeffries wrote: What I'm seeing with the auto-docs work is that a lot of header files include squid.h or protos.h for one or two simple things. That file brings with it a host of type-dependencies, directly or indirectly that clutter up the whole

Re: two xasserts in squid3

2008-02-10 Thread Adrian Chadd
On Mon, Feb 11, 2008, Amos Jeffries wrote: FWIW the keyword 'typedef' is as evil in C++ as #define, and only 'goto' is worse (and completely unnecessary since functional-C deprecated pascal). Goto is fine. You just need to know how and when to use it. My use of goto in new Squid C code I

Re: two xasserts in squid3

2008-02-10 Thread Amos Jeffries
On Mon, Feb 11, 2008, Amos Jeffries wrote: FWIW the keyword 'typedef' is as evil in C++ as #define, and only 'goto' is worse (and completely unnecessary since functional-C deprecated pascal). Goto is fine. You just need to know how and when to use it. My use of goto in new Squid C code I

Re: two xasserts in squid3

2008-02-10 Thread Adrian Chadd
On Mon, Feb 11, 2008, Amos Jeffries wrote: I end up with -one- exit location in the function and I don't have to bum around using extra functions or massively nested conditional constructs to achieve it. In fact, I've used goto in a few places to tidy up the code.. If you need to use

Re: two xasserts in squid3

2008-02-10 Thread Amos Jeffries
On Mon, Feb 11, 2008, Amos Jeffries wrote: I end up with -one- exit location in the function and I don't have to bum around using extra functions or massively nested conditional constructs to achieve it. In fact, I've used goto in a few places to tidy up the code.. If you need to use

Re: two xasserts in squid3

2008-02-10 Thread Adrian Chadd
On Mon, Feb 11, 2008, Amos Jeffries wrote: It took me quite a while to get over the goto is evil, never ever use it koolaid. But then, in C++, you should be using exceptions, not weird flow control tricks. :) I've never fully subscribed to that generalisation. But the arguments made in

Re: two xasserts in squid3

2008-02-10 Thread Robert Collins
On Mon, 2008-02-11 at 11:49 +0900, Adrian Chadd wrote: On Mon, Feb 11, 2008, Amos Jeffries wrote: I end up with -one- exit location in the function and I don't have to bum around using extra functions or massively nested conditional constructs to achieve it. In fact, I've used goto in

Re: two xasserts in squid3

2008-02-10 Thread Robert Collins
On Mon, 2008-02-11 at 16:03 +1300, Amos Jeffries wrote: typedef has its place in C particularly for portability issues, but that is vastly reduced in C++. I've only seen the event/callback function-pointers as a required use for it nowadays. That only because none has shown me a better way