Skip to content

Instantly share code, notes, and snippets.

@Au-lit
Last active June 22, 2021 16:13
Show Gist options
  • Save Au-lit/56329f9352f061c7c09911f40b9849f3 to your computer and use it in GitHub Desktop.
Save Au-lit/56329f9352f061c7c09911f40b9849f3 to your computer and use it in GitHub Desktop.

Please avoid

always (unless you have reeeally good reasons)

  • std::bind
  • std::function
  • std::type_info
  • std::vector<bool>
  • va_*
  • std::valarray
  • std::list
  • assert (instead use a thrower version / contracts)
  • all locales stuff
  • .at() methods as it's more likely to be a problem with your code
  • `#include <headerFromC.h>
  • void*
  • setjmp and longjmp

in most cases

  • std::*map, extract and merge makes it so that each node needs to be allocated individually...
  • and usually most standard containers other than std::vector/std::string
  • <c[some header]>
  • std::shared_ptr, this one is on the edge to being in the "always" section
  • all rtti
  • std::regex (maybe)
  • virtual, prefer concepts
  • sfinae, prefer concepts
  • EXIT_SUCCESS and EXIT_FAILURE (just why?)
  • using [unsigned] char to represent bytes; prefer std::byte
  • std::endian (to contest against it, because it sucks and steals a namespace)
  • std::to_chars (it's a weird api)
  • std::vformat and std::vformat_to...
  • ... and the whole formatting stuff if possible
  • potentially avoid futures as better alternatives now exists
  • std::span, prefer using concepts
@pitust
Copy link

pitust commented Jun 22, 2021

Please avoid

Always

  • Au-lit's "the bad parts of c++" list

kthx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment