Re: [HACKERS] Does this make sense:

Поиск
Список
Период
Сортировка
От geek+@cmu.edu
Тема Re: [HACKERS] Does this make sense:
Дата
Msg-id emacs-smtp-743-13941-11496-797451@export.andrew.cmu.edu
обсуждение исходный текст
Ответ на Does this make sense:  (The Hermit Hacker <scrappy@hub.org>)
Список pgsql-hackers
Then <scrappy@hub.org> spoke up and said:
> 
> char *  
> crypt_getpwdfilename()
> { 
>     
>   static char *pfnam = NULL;
>   
>   if (!pfnam)
>   { 
>     int bufsize;
>     bufsize = strlen(DataDir) + strlen(CRYPT_PWD_FILE) + 2;
>     pfnam = (char *) palloc(bufsize); 
>     spprintf(pfnam, bufsize, "%s/%s", DataDir, CRYPT_PWD_FILE);
>   }
>   
>   return pfnam;
> }
> 
> Why the check for '!ipfnam'?  Seems useless since we are setting it to
> NULL the line before...no?

static variables should be thought of as globals with only local
scope.  This variable is allocated in the BSS area rather than on the
stack at runtime.  The initialization is performed only once (usually
at compile time), and the value is retained from execution to
execution.  Basically, it always returns the previously computed
filename except for the very first call.

-- 
=====================================================================
| JAVA must have been developed in the wilds of West Virginia.      |
| After all, why else would it support only single inheritance??    |
=====================================================================
| Finger geek@andrew.cmu.edu for my public key.                     |
=====================================================================

В списке pgsql-hackers по дате отправления:

Предыдущее
От: jwieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] Does this make sense:
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] JOIN syntax. Examples?