On Thu, Feb 13, 2020 at 02:07:23AM +0000, Roy Marples wrote: > On 12/02/2020 23:58, Joerg Sonnenberger wrote: > > On Mon, Feb 10, 2020 at 04:45:35PM +0000, Roy Marples wrote: > > > On 09/02/2020 19:21, Joerg Sonnenberger wrote: > > > > On Sat, Feb 08, 2020 at 12:17:16PM +0000, Santhosh Raju wrote: > > > > > Module Name: src > > > > > Committed By: fox > > > > > Date: Sat Feb 8 12:17:16 UTC 2020 > > > > > > > > > > Modified Files: > > > > > src/external/bsd/dhcpcd/dist/src: dhcp.c > > > > > > > > > > Log Message: > > > > > external/bsd/dhcpcd: Fix a -Wconversion warning. > > > > > > > > > > Type cast uint16_t to size_t to prevent implicit type conversion. > > > > > > > > Seriously? That should not warn and no cast should be used either. > > > > > > What fix would you recommend then? > > > > Disable the warning in GCC and fill an upstream PR against it. A > > conversion from uint16_t to size_t is value preserving by definition of > > the ISO C platform limits. It should never create a warning. > > I thought this fell under int promotion and thus became signed vs unsigned?
size_t is guaranteed to be at least 16bit. If INT_MAX == 32767, an implicit cast of uint16_t would go to unsigned anyway and in all other cases, any implicit cast must be value preserving. Joerg
