On Tue, 16 Jan 2024 12:33:48 +0000
"Tummala, Sivaprasad" <sivaprasad.tumm...@amd.com> wrote:

> > > Not sure why cast is even needed, assigning uint32_t to uint16_t is
> > > not going to generate a warning with current compiler settings.
> > >  
> >
> > I was assuming compiler will complain when assigning uint32_t to uint16_t, 
> > but it
> > seems '-Wconversion' compiler flag is required for this warning.
> > Enabling this flag for DPDK build causes lots of warnings, I wonder if we 
> > should add
> > a new buildtype in meson that enables this flag.
> >
> >
> > And except from compiler warning, I think it is good to keep explicit cast 
> > where
> > assignment can cause change of value. This at worst can work as 
> > documentation
> > that assignment between different types done intentionally.  
> 
> I would prefer to keep the explicit conversion for consistency.
> Please let me know if you think otherwise.

Keep it, but casts are often a source of bug.
They defeat type checking, and often not needed.

Reply via email to