From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VryzQ-0004L5-Ub for qemu-devel@nongnu.org; Sat, 14 Dec 2013 18:51:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VryzM-0005mT-Hh for qemu-devel@nongnu.org; Sat, 14 Dec 2013 18:51:20 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:38626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VryzM-0005mO-BX for qemu-devel@nongnu.org; Sat, 14 Dec 2013 18:51:16 -0500 Received: by mail-wg0-f45.google.com with SMTP id y10so3296712wgg.12 for ; Sat, 14 Dec 2013 15:51:15 -0800 (PST) MIME-Version: 1.0 Sender: peter.crosthwaite@petalogix.com In-Reply-To: References: <20131214002607.ffe2f4cc49f976b515ac4c0e@gmail.com> Date: Sun, 15 Dec 2013 09:51:15 +1000 Message-ID: From: Peter Crosthwaite Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] a QOM Coding Conventions question List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , =?ISO-8859-1?Q?Andreas_F=E4rber?= , Antony Pavlov On Sun, Dec 15, 2013 at 9:42 AM, Peter Maydell wrote: > On 14 December 2013 23:06, Peter Crosthwaite > wrote: >> On Sat, Dec 14, 2013 at 6:26 AM, Antony Pavlov wrote: >>> What do the "< private >" and "< public >" comments exactly mean here? >> >> Private means inaccessible to everybody, including the implementation >> of class being instantiated. No one should ever dereference a private >> variable, they should be managed by QOM indirectly via casts if >> needed. Public means that at least someone can access it. Note that >> public does not declare a free-for-all. QOM class variables may be >> "public" in the sense that the class implementation may access them. >> Container devices however still can not, and they are private from >> that point of view. > > I'm not sure I find this a terribly convincing explanation. Last time > I asked this IIRC the answer was just "they need to be there for the > output of the documentation generator". > > The usual definition of 'public' vs 'private' is "what can a user of the > object rather than the implementor safely access?". That would be > actually interesting to document IMHO. (I should resurrect my patch > for marking those fields up with __private so we enforce it...) > Yes, that means we really have three levels of access, but only tags for two. Hence the confusion over public. Regards, Peter > thanks > -- PMM >