Re: Cast to uint16 in pg_checksum_page()

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Cast to uint16 in pg_checksum_page()
Дата
Msg-id 20200304044105.GD2593@paquier.xyz
обсуждение исходный текст
Ответ на Cast to uint16 in pg_checksum_page()  (David Steele <david@pgmasters.net>)
Ответы Re: Cast to uint16 in pg_checksum_page()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Mar 03, 2020 at 06:37:36PM -0500, David Steele wrote:
> Hackers,
>
> The current code in checksum_impl.h does not play nice with -Wconversion on
> gcc:
>
> warning: conversion to 'uint16 {aka short unsigned int}' from 'uint32 {aka
> unsigned int}' may alter its value [-Wconversion]
>                                           return (checksum % 65535) + 1;
>                                                  ~~~~~~~~~~~~~~~~~~~^~~
>
> It seems like an explicit cast to uint16 would be better?

Attempting to compile the backend code with -Wconversion leads to many
warnings, still there has been at least one fix in the past to ease
the use of the headers in this case, with b5b3229 (this made the code
more readable).  Should we really care about this case?
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Some problems of recovery conflict wait events
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: Some problems of recovery conflict wait events