Re: Code-Cleanup: char* -> const char*

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: Code-Cleanup: char* -> const char*
Дата
Msg-id 45FCCEBB.4050102@samurai.com
обсуждение исходный текст
Ответ на Code-Cleanup: char* -> const char*  (Stefan Huehner <stefan@huehner.org>)
Ответы Re: Code-Cleanup: char* -> const char*  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Code-Cleanup: char* -> const char*  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-patches
Stefan Huehner wrote:
> attached patches marks several char* variables as const where they are
> initialized with constant strings.
>

I really wonder how much value there is in using the "const" modifier
very widely. "const" for function parameters is valuable (because it
adds information about the function's behavior to its interface). It
also makes sense to use "const" on global variables, when it reduces the
size of the binary's data segment. Beyond that, you reach the point of
diminishing returns fairly quickly, IMHO. (In C, anyway; it makes more
sense to use it widely in C++, of course.)

I also don't see the value in modifying the regexp code, as that is just
an import of Henry Spencer's regexp package. I'm not sure whether we're
planning on merging any upstream changes any time soon, but making
cosmetic changes to the RE code will only make that more difficult.

Anyway, I'll apply this tomorrow without the RE changes, barring any
objections.

BTW, the preferred format for patches is context diffs, not unified diffs.

-Neil


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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: ecpg threading vs win32
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Code-Cleanup: function declarations (void, and k&r style)