Re: Remove useless casting to the same type
| От | David Geier |
|---|---|
| Тема | Re: Remove useless casting to the same type |
| Дата | |
| Msg-id | 53f2e84b-26e0-4ab9-a7c7-0f5773292664@gmail.com обсуждение исходный текст |
| Ответ на | Re: Remove useless casting to the same type (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>) |
| Список | pgsql-hackers |
On 25.11.2025 06:46, Bertrand Drouvot wrote: > I think that the variadic calls in the patch are related to functions that > can benefits from -Wformat. Let's focus on those: with the cast one would need > to verify 3 things: variable type, cast and format specifier. > Without the cast then only 2 things and the compiler can verify these match via > -Wformat warnings. > > With the cast, the compiler only checks that the cast result matches the format, > not whether the cast itself is correct, so I'm in favor of removing the cast, > thoughts? > I agree. It's better if we only have the casts in places where we actually want to change the type before printing. Another benefit is that one can directly deduct the type from the log / print statement by looking at the format specifier. -- David Geier
В списке pgsql-hackers по дате отправления: