Re: Coding style point: "const" in function parameter declarations

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Coding style point: "const" in function parameter declarations
Дата
Msg-id BANLkTikzttf_Sjt-kDWGj7VyzuhOgwJQZQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Coding style point: "const" in function parameter declarations  (Greg Stark <stark@mit.edu>)
Список pgsql-hackers
On 23 June 2011 00:37, Greg Stark <stark@mit.edu> wrote:
> Hm. I have to say the single most confusing thing about the Postgres
> source that took me a *long* time to get over was remembering that
> some of the typedefs were already pointers and some weren't. It seems
> silly now but when I was trying to understand what the intent of a
> function was and it wasn't obvious that some of the arguments appeared
> to be pass by value but were actually pass by reference it made things
> really surprising.

I agree that the inconsistency is annoying. If we were starting from
scratch, I'd encourage abandoning the convention. It's a leaky
abstraction.

At the risk of saying something that will raise eyebrows, I'll point
out that the win32 API follows a similar practice. The difference is
that they have consistent conventions in how they name their typdefs,
so that you get to learn the patterns.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Coding style point: "const" in function parameter declarations
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: crash-safe visibility map, take five