This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Private data members


Daniel Jacobowitz wrote:

> On Wed, Jul 29, 2009 at 12:45:32PM +0400, Vladimir Prus wrote:
>> 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.
> 
> How about struct { int ignore_count; } private; ?

Might work.

> I don't think ignore_count_ is clear.

Well, it's a convention for naming private variables used by roughly
half of C++ developers, so I expect many current and future contributors
know it already.

- Volodya



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]