Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "tromey@redhat.com" <tromey@redhat.com>
Cc: Vladimir Prus <vladimir@codesourcery.com>,
	  "gdb@sources.redhat.com" <gdb@sources.redhat.com>
Subject: Re: Private data members
Date: Wed, 29 Jul 2009 17:30:00 -0000	[thread overview]
Message-ID: <4A70854E.9080106@vmware.com> (raw)
In-Reply-To: <m363dby071.fsf@fleche.redhat.com>

Tom Tromey wrote:
>>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:
> 
> Volodya> I have run into a case when it's desirable that all
> Volodya> modifications of a certain structure field in GDB codebase go
> Volodya> via function that can enforce necessary invariants.
> 
> Volodya> At the moment, there are at least 3 places that directly assign
> Volodya> a value to that field, and while I can convert them easily,
> Volodya> nothing will prevent a direct assignment to appear in future.
> 
> In the past somebody solved this same problem for struct value by
> putting the struct definition into value.c and adding a bunch of
> accessors.
> 
> I'm lukewarm about this technique, but it can be made to work.
> 
> Daniel's suggested approach would also be fine with me.

How about combining the two?

Define struct breakpoint in breakpoint.h, put any public members
in there, and then include a member "struct breakpoint_private"
that is only a forward declaration.

Then define "struct breakpoint_private" in breakpoint.c, so that
its members will be invisible outside of that module.


  reply	other threads:[~2009-07-29 17:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29  8:45 Vladimir Prus
2009-07-29 13:39 ` Daniel Jacobowitz
2009-07-29 13:41   ` Vladimir Prus
2009-07-29 16:18     ` Samuel Bronson
2009-07-29 16:50       ` Vladimir Prus
2009-07-29 15:32 ` Tom Tromey
2009-07-29 17:30   ` Michael Snyder [this message]
2009-07-29 21:56     ` Andreas Schwab
2009-07-29 22:39       ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A70854E.9080106@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb@sources.redhat.com \
    --cc=tromey@redhat.com \
    --cc=vladimir@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox