Re: Coding style and naming conventions for C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2018-01-30 at 04:47 -0500, Frediano Ziglio wrote:
> > 
> > 3. Namespace coding style
> > 
> > a) Let's not use `using namespace ...` ever even in .cpp files (see
> > i.e. [1]). In streaming agent we have at the beginning of every
> > .cpp:
> > 
> > using namespace std;
> > using namespace SpiceStreamingAgent;
> > 
> > For namespace std, "std::" is not a long prefix, clearly expresses
> > the
> > identifier is from the standard library and AFAIK most C++ projects
> > use
> > it this way.
> > 
> > For namespace SpiceStreamingAgent, I didn't even know it worked for
> > definition of symbols in the namespace. First time I see it, it is
> > very
> > unusual. see b).
> > 
> 
> Not clear what's unusual here.
> So for every class having something like
> spice::streaming_agent::ClassName ?
> Sounds a bit long.

The way it's (almost universally, AFAIK) done in .cpp is the same as in
the headers, by declaring the namespace scope, as demonstrated:

> > namespace spice {
> > namespace streaming_agent {
> > 
> > THE_CODE
> > 
> > }} // namespace spice::streaming_agent

Lukas
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]