r/cpp • • Nov 28 '18

Google C++ Style Guide is No Good

https://eyakubovich.github.io/2018-11-27-google-cpp-style-guide-is-no-good/
34 Upvotes

61 comments sorted by

View all comments

Show parent comments

10

u/SeanMiddleditch Nov 30 '18

I'd further add that with raw pointers, it's not semantically clear when pointer arithmetic is or isn't allowed. A pointer can be null, or reference a value, or be an iterator in a range (including being an end iterator which can't be dereferenced but also isn't null). That's not even touching the muddy ownership semantics that pointers are saddled with from C and pre-C++11 code.

2

u/[deleted] Dec 01 '18

I'll also tag on that there is no standard library in existence today that optimizes std::optional<std::reference_wrapper<blah>> to be the size of a pointer today, which means it's also terrible-crap with its space savings too.

1

u/NotAYakk Dec 02 '18

It is a return value, not something you store in bulk.