[webkit-dev] "using" statement clarifications
Chris Jerdonek
chris.jerdonek at gmail.com
Mon Dec 7 20:42:25 PST 2009
On Mon, Dec 7, 2009 at 9:30 AM, Darin Adler <darin at apple.com> wrote:
> Sorry, I wasn’t able to follow all the logic in the style guideline and the email message nor fully understand what the script enforces. So I’ll give my view on this and hope it helps.
Thanks. To be clear, I will restate your clarifications and
suggestions as I understand them. I will also explain how they
compare to the guidelines as currently stated.
(1) Add this to the guidelines: Do not use statements of the form
"using std:foo" in implementation files. Use "using namespace std"
instead. (The script currently enforces this rule, but for header
files and not just implementation files.)
(2) Clarify that the rule to put "using namespace" statements near the
beginning of a file applies only to implementation files. (It
currently applies also to header files.) Also, strengthen the rule so
it applies to all "using" statements in implementation files and not
just "using namespace" statements.
> I also don’t see a need for "using" statements of either kind further down in the file. It seems they can go at the top, right after the includes. But maybe I’ve missed some useful case.
The existing guidelines single out the case of nested namespaces and
says they should appear further down when the parent exists. For
example, instead of this--
> using namespace WebCore::HTMLNames;
>
> namespace WebCore {
do this--
> namespace WebCore {
>
> using namespace HTMLNames;
Should nested namespaces remain an exception?
--Chris
More information about the webkit-dev
mailing list