Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Private data members
@ 2009-07-29  8:45 Vladimir Prus
  2009-07-29 13:39 ` Daniel Jacobowitz
  2009-07-29 15:32 ` Tom Tromey
  0 siblings, 2 replies; 9+ messages in thread
From: Vladimir Prus @ 2009-07-29  8:45 UTC (permalink / raw)
  To: gdb


I have run into a case when it's desirable that all modifications
of a certain structure field in GDB codebase go via function that
can enforce necessary invariants. Specifically, the ignore_count
in struct breakpoint does not make any sense for tracepoint, therefore
I want to introduce a function that will throw if non-zero ignore count
is ever set for a tracepoint.

At the moment, there are at least 3 places that directly assign
a value to that field, and while I can convert them easily, nothing
will prevent a direct assignment to appear in future. In C++,
one would use 'private' visibility for that member, but it's not
available in C. So, how about introducing a small convention --
that members with names ending in '_' are 'private' and should
never be accessed by outside code. Another alternative is to
modify the comment on ignore_count, but that is much more likely
to be ignored.

Comments?

- Volodya


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-07-29 22:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-29  8:45 Private data members 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
2009-07-29 21:56     ` Andreas Schwab
2009-07-29 22:39       ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox