Re: [PATCH v1 2/2] auxdisplay: charlcd: Provide a forward declaration

From: Andy Shevchenko
Date: Tue Apr 23 2024 - 12:35:13 EST


On Thu, Apr 11, 2024 at 01:30:25PM +0300, Andy Shevchenko wrote:
> On Thu, Apr 11, 2024 at 09:30:31AM +0200, Geert Uytterhoeven wrote:
> > On Tue, Apr 9, 2024 at 6:15 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > While there is no compilation error, strictly speaking compiler
> > > should know about used types beforehand. Provide a forward decoration
> >
> > declaration
>
> Thanks, I updated locally. Please, see my answer below.
>
> > > for struct charlcd_ops before using it in struct charlcd.

..

> > > +struct charlcd_ops;
> > > +
> > > struct charlcd {
> > > const struct charlcd_ops *ops;
> >
> > No forward declaration is needed at this point, as ops is a _pointer_ to
> > the structure.
>
> The same way as in all other cases. We may drop all of them, but strictly
> speaking (as I mentioned in the commit message) this is a good practice.
>
> I.o.w. a forward declaration of custom data types is used for _pointers_.
>
> > > const unsigned char *char_conv; /* Optional */

Hmm, so what's the conclusion?

--
With Best Regards,
Andy Shevchenko