Mailing List Archive

static
http_include.c starts.....


/* These are stored statically so that they can be reformatted quickly */
static time_t date,lm;

I think I'm missing something. What does that comment mean in this
context ?
Doesn't static only define these variables to be "global" in
this file ? I don't understand how this relates to reformatting speed,
whatever that is.

anyone ?

robh
Re: static [ In reply to ]
/*
* "static" by Rob Hartill <hartill@ooo.lanl.gov>
* written Mon, 10 Apr 95 14:25:55 MDT
*
* http_include.c starts.....

> /* These are stored statically so that they can be reformatted quickly */
> static time_t date,lm;

* I think I'm missing something. What does that comment mean in this
* context ? Doesn't static only define these variables to be
* "global" in this file ? I don't understand how this relates to
* reformatting speed, whatever that is.
*/

Yes, that's what it means in this context. What it means is that I
didn't want to make them globals, but decided it wasn't so bad to do
that. The reformatting speed is when you use #config timefmt to change
the string version of those variables, with these globals it doesn't
have to call time(NULL) again or stat().

This is mostly because I didn't do what I should have in that I didn't
make a structure out of the per-request variables for parsed HTML. Had
I done that, these two vars would have been just two more entries in
that struct.

--Rob
Re: static [ In reply to ]
/*
* "Re: static" by Rob Hartill <hartill@ooo.lanl.gov>
* written Mon, 10 Apr 95 15:44:04 MDT
*
* Where did you learn to comment like that ? and is there a cure for
* it ? ;-)
*
*/

My prior experience to httpd was all writing games in assembly
language. If someone looking at someone else's code just used the
comments to figure out it did, they probably wouldn't understand it
enough to change it effectively. Usually, also, the people working on
the projects were in very close quarters so you could just ask them
why something was the way it was. Also, games are a one shot deal; you
do one, and you move on to the next one. Aside from libraries of
common code, most of it is used once and dumped overboard six months
later for the next project. Sega and Nintendo don't pay extra for
documented code.

So prior to httpd I didn't have any experience managing long-term
software projects. Most of the lack of documentation and design flaws
in httpd stem from that very basic lack of experience.

--Rob
Re: static [ In reply to ]
>
> > /* These are stored statically so that they can be reformatted quickly */
> > static time_t date,lm;
>
> Yes, that's what it means in this context. What it means is that I
> didn't want to make them globals, but decided it wasn't so bad to do
> that. The reformatting speed is when you use #config timefmt to change
> the string version of those variables, with these globals it doesn't
> have to call time(NULL) again or stat().
>
> This is mostly because I didn't do what I should have in that I didn't
> make a structure out of the per-request variables for parsed HTML. Had
> I done that, these two vars would have been just two more entries in
> that struct.

Cheers Rob.

Where did you learn to comment like that ?
and is there a cure for it ? ;-)


robh