httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <>
Subject Re: [PATCH] using freed memory, and a memory debugger
Date Mon, 13 Oct 1997 12:48:51 GMT
Dean Gaudet wrote:
> [I hope Martin doesn't mind me copying part of his private message here.]
> On Wed, 8 Oct 1997, Martin Kraemer wrote:
> > What I dislike (from a debugging point of view) is the abstraction to
> > treat all kinds of core structures as "void *". Of course, it hides the
> > inner workings and data from the modules (thus prohibiting direct access
> > to core variables by modules), but it disables the chance of the
> > compiler detecting wrong parameter passing. You mentioned the danger of
> > this occurring in one of your previous mails. Maybe each core structure
> > should have a "type tag" magic number at the beginning, too. Then each
> > cast from "void*" to, e.g., core_dir_config could be verified (and
> > possibly aborted) before an invalid pointer type was returned from
> > get_module_config().
> Yeah ... magic numbers would be really cool for this.  (Ben don't
> mention C++!) 

I won't, but I will mention that I don't like the use of void * for
hiding. I prefer things like:

typedef core_dir_config *CORE_DIR_CONFIG_HANDLE;

If you _really_ want to hide the structure, you can also put it into a
"private" header. That way you get type checking and hiding.



Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|
and Technical Director|Email: |Apache-SSL author
A.L. Digital Ltd,     |
London, England.      |"Apache: TDG"

View raw message