On Thu, Jan 7, 2010 at 1:34 PM, Jeremy Orlow <[email protected]> wrote:
> (As discussed during lunch...) Why not just do this in this case and
> remove EmptyString() altogether?
>
> const std::string& MyClass::foo() const {
> static std::string empty = EmptyString();
> return (everything == OK) ? member_string : empty;
> }
>
This is illegal per the Google style guide:
"Objects with static storage duration, including ... function static
variables, must be Plain Old Data (POD): only ints, chars, floats, or
pointers, or arrays/structs of POD. ... This rule completely disallows
vector (use C arrays instead), or string (use const char [])."
If you see code like this in our codebase, please fix it to not use
static/global non-POD types.
PK
--
Chromium Developers mailing list: [email protected]
View archives, change email options, or unsubscribe:
http://groups.google.com/group/chromium-dev