Re: const correctness
От | Dimitri Fontaine |
---|---|
Тема | Re: const correctness |
Дата | |
Msg-id | m2fwhxj6ed.fsf@2ndQuadrant.fr обсуждение исходный текст |
Ответ на | Re: const correctness ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
Список | pgsql-hackers |
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes: >> In C, the impedance match is a lot worse, so you have to pick and >> choose where const is worth the trouble. > > Agreed. And I'm not sure how much of what Thomas is proposing is > worth it; it just seems prudent to consider it while the offer is > being made to do the work. If the gain is for human readers of the API rather than the compiler and some level of automated checking, what about this trick: #define constp Then you can use it wherever you want to instruct readers that the parameter is a constant, it's now a noise word as far as the compiler is concerned (thanks to the precompiler replacing it with an empty string). Regards, -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
В списке pgsql-hackers по дате отправления: