From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMyCy-00048t-Kb for qemu-devel@nongnu.org; Wed, 14 Nov 2018 11:40:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMyCr-0002zP-GF for qemu-devel@nongnu.org; Wed, 14 Nov 2018 11:40:04 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46282) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMyCr-0002xL-88 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 11:39:57 -0500 Received: by mail-wr1-f68.google.com with SMTP id l9so5144097wrt.13 for ; Wed, 14 Nov 2018 08:39:55 -0800 (PST) References: <20181114132931.22624-1-marcandre.lureau@redhat.com> <16b78816-f2cc-a1e5-0d21-906fc2dbaa3d@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: Date: Wed, 14 Nov 2018 17:39:52 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] vmstate: constify VMStateField List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: Peter Maydell , Fam Zheng , "Michael S. Tsirkin" , Aurelien Jarno , Cornelia Huck , Mark Cave-Ayland , dgilbert@redhat.com, quintela@redhat.com, "open list:S390" , "open list:ARM" , "open list:PowerPC" , Gerd Hoffmann , Aleksandar Markovic , Paolo Bonzini , Stafford Horne , Richard Henderson , Christian Borntraeger , Artyom Tarasenko , David Gibson Hi Thomas, On 14/11/18 17:29, Thomas Huth wrote: > On 2018-11-14 16:32, Philippe Mathieu-Daudé wrote: >> >> What about enforcing the constness in the typedef? >> >> -- >8 -- >> @@ -32 +32 @@ typedef struct VMStateDescription VMStateDescription; >> -typedef struct VMStateField VMStateField; >> +typedef const struct VMStateField VMStateField; >> --- > > 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.