httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Tatarinov <tatar...@prairie.NoDak.edu>
Subject Re: A question on ka requests
Date Wed, 04 Feb 1998 22:20:30 GMT
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
}

I understand that in C you can just use braces to achive the second case
but that wouldn't work if you need c later.

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

igor

Mime
View raw message