
C++ Tips of the Week - fauigerzigerk
https://abseil.io/tips/
======
ThePhysicist
In a similar vein, we published a „little book of Python anti patterns“ a
while back, maybe some people find it useful:

[https://docs.quantifiedcode.com/python-anti-
patterns](https://docs.quantifiedcode.com/python-anti-patterns)

------
hartcw
Naming of the title reminds me of the best C book I've read, "Expert C
Programming: Deep C Secret" by Peter Van Der Linden.

[https://g.co/kgs/Gyvg69](https://g.co/kgs/Gyvg69)

------
deepakkarki
For those interested in such insightful tech reads, I run
[https://discoverdev.io](https://discoverdev.io) \- a daily curated list of
top 8 to 10 engineering blog posts!

Published every weekday!

------
HellDunkel
Here is my personal advice: whatever code you write, make sure you can grab it
and run leaving no trace behind.

------
mbrubeck
Use string_view, but beware of use-after-free bugs like
[https://github.com/isocpp/CppCoreGuidelines/issues/1038](https://github.com/isocpp/CppCoreGuidelines/issues/1038)

~~~
inetknght
Think of string_view as a non-owning pointer to a known-size array. If the
array is moved or destroyed, then string_view is left dangling... just like a
pointer.

------
ndh2
> _We’ve decided to expose most of these tips to the Abseil development
> community, and the C++ community at large. Over the coming months, we’ll be
> posting new tips as we review and refine them for publication. Not all the
> entries we’ve written are relevant to the outside world; some were specific
> to our internal tools and abstractions, and some have become obsolete as the
> language has changed._

~~~
xarball
I followed a few links to Abseil:

> Consisting of the foundational C++ and Python code at Google, Abseil
> includes libraries that will grow to underpin other Google-backed open
> source projects like gRPC, Protobuf and TensorFlow.

This library already seems like it is suffering from scope-creep. Tensorflow,
gRPC, and Protobuf are hardly related to improving the C++ standard. Why are
these even in the same library at all?

~~~
ndh2
They're not. They will be using Abseil.

------
unkown-unknowns
Seems that only four of the tips are available?

~~~
bpicolo
They're doing one a week, starting 4 weeks ago.

~~~
dogruck
They should reindex their archive of tips. I was baffled by the jump from tip
1 to 55 to 77.

Edit: the indexing is explained in a note on the site.

~~~
cbcoutinho
The index is related to when the tips were published internally at Google, and
are not re-indexed for the sake of those who have already seen them

------
branchless
I've failed the first test: how do I get a list of all "tips"?

~~~
ma2rten
I think they only made those 4 public for now.

~~~
branchless
shame, was going to binge read them

------
signa11
something similar was initiated by herb-sutter as well in his 'guru of the
week' (gotw) columns. which then became books in their own right aka
'exceptional c++' series.

are these tips more 'modernish' ?

~~~
SwellJoe
Tip #1 covers a feature found in C++17, so I'd say yes.

~~~
jzwinck
Tip #1 appears on the surface to be about C++17's std::string_view, but many
shops had something similar to string_view for a decade or more before C++
made it official. The tips are not presented in their original form; edits
have been made (as per the linked page). I think Google had something like
string_view by 2009 at the latest, using C++03 compilers.

~~~
dogruck
Yeah, discussing the origins of string_view is like talking about who invented
base-two numbering. :-)

~~~
humanrebar
Yes. It is a small step from the well-worn convention to pass each char*
around with its length.

~~~
signa11
> Yes. It is a small step from the well-worn convention to pass each char*
> around with its length.

kind of surprising to note that implicit 'string_view' conversions are now
regarded as a good thing?

on a side note, the language is _complicated_, and shows no signs of stopping
! 3 articles on move/copy ctor's and only one that applies to programming in
general.

