Using double underscores consistently for internal-only code.
From: Karl Fogel <kfogel_at_red-bean.com>
Date: Wed, 20 Aug 2008 16:28:42 -0400
Many of the symbols we define in include/private/*.h are not using the
In http://subversion.tigris.org/hacking.html#other-conventions, we
I think it's a good convention, and more important than it might
I'd like to clean that up. Anyone object?
Here's the IRC conversation, lightly edited for clarity:
------------------------------------------------------------------------
<gstein> I had omitted those, but it *does* look like we do that in
<gstein> functions are exported from the lib, so the __ is necessary
<gstein> so I skipped them
<gstein> sounds like I should add double-under to the types?
<rooneg> yeah, it's kind of silly to do it for typdefs. if we are, i
<gstein> rooneg: hehe
<kfogel> gstein: I thought wc_db is only going to be used within
<gstein> the only typedef in include/* and include/private/* with a
<kfogel> And in fact only by libsvn_wc?
<gstein> kfogel: yes
<gstein> correct
<kfogel> Huh? Everything in include/private/ should use double
<kfogel> I don't know if they do or not, but they sure should. WTF.
* kfogel looks
<rooneg> kfogel: why should typdefs do it? they don't introduce a
<kfogel> rooneg: hrm? How does a typedef not introduce a public
<kfogel> I mean, it's a symbol like any other symbol...
<kfogel> You mean into the linker?
<rooneg> yes
<kfogel> I'm talking about a reader looking at a type and knowing
<rooneg> without the header file you can't actually access it, so if
<julianf> perhaps this is about developer sanity rather than the
* gstein points to rooneg
<kfogel> julianf: exactly
<kfogel> that's what I'm saying
<gstein> hmm
<gstein> dang. he's got a point.
* gstein smirks
<kfogel> sorry :-)
<rooneg> i'd say that the fact that it lives in a private header file
<kfogel> When reading code, one wants to know (without having to look
<julianf> the other side of the debate has a point too... some sort of
<kfogel> rooneg: sorry, I would have said something ages ago about
<rooneg> i'm not actually convinced that's the usual use case for
<rooneg> i mean the only time a developer needs to know is when
<kfogel> rooneg: mmm, I don't think so. The best environment is one
<kfogel> And then they'll start making all sorts of inferences based
<kfogel> It's not a "need to know" kind of thing, IMHO. It's more of
<rooneg> i don't know, i don't tend to infer such things from a
<kfogel> rooneg: Okay, so maybe you're different. But I know I do :-).
* gstein is sold
<kfogel> I hope Greg got a good price for himself.
<kfogel> If it was in Euros, he should be okay...
<gstein> the typedef is not always in front of you
<rooneg> any typedef that's private will be surrounded by private
<gstein> so when you see the type floating around, then this tells
<gstein> unfortunately, mexican pesos
<kfogel> mmmm, sorry 'bout that man
<rooneg> anyway, like i said, i haven't written svn code in like
<gstein> lol
<julianf> Just a thinking-point: If we were to compile this stuff with
<kfogel> rooneg:
<kfogel> rooneg: apparently, we already had this discussion, and
<rooneg> heck, if we really want to get technical, having double
<julianf> oh...
<kfogel> rooneg: whoa, really?
<CIA-35> gstein * r32595 /trunk/subversion/libsvn_wc/wc_db.h:
<neels> julianf: one of your(?) new tests is failing, even though I
<rooneg> technically anything with two underscores in it is reserved
<rooneg> in practice, implementations only use leading double
<CIA-35> arfrever * r32596 /trunk/configure.ac: Support Neon
<kfogel> rooneg: huh. Well, we'll just pretend we don't know that.
<kfogel> :-)
<rooneg> can't find the exact reference for the C standard, but it's
---------------------------------------------------------------------
|
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.