httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: A question on ka requests
Date Wed, 04 Feb 1998 23:57:58 GMT


On Wed, 4 Feb 1998, Igor Tatarinov wrote:

> Dean Gaudet wrote:
> > 
> > On Wed, 4 Feb 1998, Igor Tatarinov wrote:
> > 
> > > But the real reason for all this is that C doesn't allow you to declare
> > > a variable exactly at the moment when you need it.
> > 
> > I don't understand how this means that it's suddenly fine to go and
> > INITIALIZE a variable far before the exact moment that you need it.
> 
> I am not sure I understood this comment right but instead of
> int function() {
>  config *c=getconfig();
>  ... (100 lines of code that doesn't use c) ...
>  1 line that uses c
> }
> 
> you can write (in C++, not in C)
> int function() {
>  ...(100 lines ...)
>  config *c=getconfig()
>  1 line that uses c
> }

And in C you can write:

int function()
{
    config *c;
    ...(100 lines ...)
    c = getconfig()
    1 line that uses c
}

> So instead of moving initialization to declaration, C++ allows moving
> declaration to initialization.

I'm fully aware of that.

Dean


Mime
View raw message