1. X
  2. Affective C++
Log inSign up
Affective C++
298 posts
Image
user avatar
Affective C++
@AffectiveCpp
The authoritative guide for High Quality C++! (Warning: These are all jokes.)
Joined September 2018
71
Following
3,767
Followers
RepliesRepliesMediaMedia

Log in or sign up for X

See what’s happening and join the conversation

Continue with phone
or
Log in with username or email
Terms·Privacy·Cookies·Accessibility·Ads Info·© 2026 X Corp.
  • Pinned
    user avatar
    Affective C++
    @AffectiveCpp
    Sep 23, 2018
    Replying to @AffectiveCpp and @OmerFarukDinder
    (Just in case someone missed the point: @AffectiveCpp is a humorous account, everything we post is spectacularly wrong.)
  • user avatar
    Affective C++
    @AffectiveCpp
    Jun 10, 2022
    Item 80: A typical source of error is (transitively) including the same header file in many compilation units. This is an ODR violation. Instead, make a separate copy of that header file for each source file. #cplusplus #cpp #affectivecpp
  • user avatar
    Affective C++
    @AffectiveCpp
    May 16, 2022
    Item 79: Choosing the right data structure is critical. Is memset too slow? Consider memunordered_set instead, to avoid the red-black tree in favor of hashing. See also memmap for key/value, mempriority_queue, memstack, etc. (thanks @jfbastien) #cplusplus #cpp #affectivecpp
  • user avatar
    Affective C++
    @AffectiveCpp
    May 13, 2022
    Item 78: With multiply wrapped objects, such as unique_ptr to optional, if you want to access a member of wrapped object, use the long arrow operator. Instead of v.get()->value().member, do v--->member. @ivan_cukic explains: cukic.co/2017/07/12/the… #cplusplus #cpp #affectivecpp
    Image
    cukic.co
    The long arrow operator in C++ (not the usual one) | Ivan Čukić
    Dr Ivan Čukić -- author of the 'Functional Programming in C++' book, KDE developer and Free/Libre Software enthusiast.
  • user avatar
    Affective C++
    @AffectiveCpp
    Apr 28, 2022
    Item 77: The difference between char and wchar_t is that char is for narrow characters, and wchar_t is for wide characters. Store letters like i and j in a char, and letters like m and w in a wchar_t. (Thanks @chrisoldwood) #cplusplus #cpp #affectivecpp
    user avatar
    Chris Oldwood
    @chrisoldwood
    Apr 27, 2022
    The difference between char and wchar_t in C++ is that char is for narrow characters and wchar_t is for wide characters. So you’d store letters like i, l, and t in a char but M and W in a wchar_t…
  • See @AffectiveCpp's full profile

    Sign up
    Log in
Advertisement
Advertisement