On 2018-11-14 17:49, Peter Maydell wrote: > On 14 November 2018 at 16:39, Philippe Mathieu-Daudé <phi...@redhat.com> > wrote: >> Hi Thomas, >> >> On 14/11/18 17:29, Thomas Huth wrote: >>> Please don't. For rationale, see: >>> https://www.kernel.org/doc/html/v4.19/process/coding-style.html#typedefs >> >> >> Thanks for the pointer, I am interested in understanding why not do that. >> However in the link you pasted I don't see a rational about enforcing >> constness, I understand that since this case doesn't match the 5 rules, we >> should use 'struct VMStateField' directly and remove the typedef. > > QEMU's coding style is not the kernel's. In the kernel, yes, > they prefer "struct foo". In QEMU we generally prefer to use > a typedef for most structs.
Yes - my point was simply: Let's do not start to hide more things beside "struct" in a typedef. If I look at QEMU source code containing just a "VMStateField", I expect it to be a shortcut for "struct VMStateField". I'd never expect that it also contains the "const" attribute. I'm pretty sure that this would cause some confusion in the future otherwise. Thomas