Re: [squid-users] Adding Header file

From: Paras Fadte <plfgoa@dont-contact.us>
Date: Tue, 29 Apr 2008 11:13:12 +0530

Hi,

Is it necessary to have a zero argument constructor If there is a
one/two/three etc argument constructor in C++ ? Also, what is the
significance of using size_t instead of a "int" data type ?

Thank you.

-Paras

On Fri, Apr 18, 2008 at 9:25 AM, Amos Jeffries <squid3@treenet.co.nz> wrote:
>
> Henrik Nordstrom wrote:
>
> > Tor 2008-04-17 klockan 21:19 +0530 skrev Paras Fadte:
> >
> >
> > > With respect to C++ , is a static member of a class like a global
> > > variable?
> > >
> >
> > Yes, a class scoped (not object) global variable.
> >
> >
> > > Does OOP in particular consider use of a static/global
> > > variable as a bad programming practice?
> > >
> >
> > Most do..
> >
> > But it do make life a lot easier..
> >
>
>
> Which for leads to a few well-known problems, and the reasons why its often
> considered bad. I'm not hypocritical to outlaw it, but advise Programming
> carefully if you think you need any.
>
>
> I judge it based on the objects design.
> - 'manager' type class with only one instance static/global can be useful,
> simpler, and faster. Especially to guarantee the rule that there is only
> one. Go ahead consider it.
> - minor object likely to have several usages or re-usage, static becomes a
> major headache.
> - static variable in functions called recursively, MAJOR headache.
>
>
> globals, I don't think are as evil as made out to be. Often a little
> thought can lead you to conclude a direct need for being global. Or to a way
> of cleanly scoping them somewhere so it does not matter.
>
> My cleanup side-project is going through the main squid headers testing all
> the usages these days.
>
>
>
> Amos
> --
> Please use Squid 2.6.STABLE19 or 3.0.STABLE4
>
Received on Tue Apr 29 2008 - 05:43:20 MDT

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