Preskoči na sadržaj
Korištenjem servisa na Twitteru pristajete na korištenje kolačića. Twitter i partneri rade globalno te koriste kolačiće za analize, personalizaciju i oglase.

Za najbolje sučelje na Twitteru koristite Microsoft Edge ili instalirajte aplikaciju Twitter iz trgovine Microsoft Store.

  • Naslovnica Naslovnica Naslovnica, trenutna stranica.
  • O Twitteru

Spremljena pretraživanja

  • obriši
  • U ovom razgovoru
    Ovjeren akauntZaštićeni tweetovi @
Predloženi korisnici
  • Ovjeren akauntZaštićeni tweetovi @
  • Ovjeren akauntZaštićeni tweetovi @
  • Jezik: Hrvatski
    • Bahasa Indonesia
    • Bahasa Melayu
    • Català
    • Čeština
    • Dansk
    • Deutsch
    • English
    • English UK
    • Español
    • Filipino
    • Français
    • Italiano
    • Magyar
    • Nederlands
    • Norsk
    • Polski
    • Português
    • Română
    • Slovenčina
    • Suomi
    • Svenska
    • Tiếng Việt
    • Türkçe
    • Български език
    • Русский
    • Српски
    • Українська мова
    • Ελληνικά
    • עִבְרִית
    • العربية
    • فارسی
    • मराठी
    • हिन्दी
    • বাংলা
    • ગુજરાતી
    • தமிழ்
    • ಕನ್ನಡ
    • ภาษาไทย
    • 한국어
    • 日本語
    • 简体中文
    • 繁體中文
  • Imate račun? Prijava
    Imate račun?
    · Zaboravili ste lozinku?

    Novi ste na Twitteru?
    Registrirajte se
Profil korisnika/ce lefticus
Jason Turner
Jason Turner
Jason Turner
@lefticus

Tweets

Jason Turner

@lefticus

http://CppCast.com  co-host, http://cppbestpractices.com  curator, http://chaiscript.com , C++ Weekly https://www.youtube.com/c/JasonTurner-lefticus … he/him

Colorado, USA
emptycrate.com
Vrijeme pridruživanja: travanj 2009.

Tweets

  • © 2020 Twitter
  • O Twitteru
  • Centar za pomoć
  • Uvjeti
  • Pravila o privatnosti
  • Imprint
  • Kolačići
  • Informacije o oglasima
Odbaci
Prethodni
Sljedeće

Idite na profil osobe

Spremljena pretraživanja

  • obriši
  • U ovom razgovoru
    Ovjeren akauntZaštićeni tweetovi @
Predloženi korisnici
  • Ovjeren akauntZaštićeni tweetovi @
  • Ovjeren akauntZaštićeni tweetovi @

Odjava

Blokiraj

  • Objavi Tweet s lokacijom

    U tweetove putem weba ili aplikacija drugih proizvođača možete dodati podatke o lokaciji, kao što su grad ili točna lokacija. Povijest lokacija tweetova uvijek možete izbrisati. Saznajte više

    Vaši popisi

    Izradi novi popis


    Manje od 100 znakova, neobavezno

    Privatnost

    Kopiraj vezu u tweet

    Ugradi ovaj Tweet

    Embed this Video

    Dodajte ovaj Tweet na svoje web-mjesto kopiranjem koda u nastavku. Saznajte više

    Dodajte ovaj videozapis na svoje web-mjesto kopiranjem koda u nastavku. Saznajte više

    Hm, došlo je do problema prilikom povezivanja s poslužiteljem.

    Integracijom Twitterova sadržaja u svoje web-mjesto ili aplikaciju prihvaćate Twitterov Ugovor za programere i Pravila za programere.

    Pregled

    Razlog prikaza oglasa

    Prijavi se na Twitter

    · Zaboravili ste lozinku?
    Nemate račun? Registrirajte se »

    Prijavite se na Twitter

    Niste na Twitteru? Registrirajte se, uključite se u stvari koje vas zanimaju, i dobivajte promjene čim se dogode.

    Registrirajte se
    Imate račun? Prijava »

    Dvosmjerni (slanje i primanje) kratki kodovi:

    Država Kod Samo za korisnike
    Sjedinjene Američke Države 40404 (bilo koje)
    Kanada 21212 (bilo koje)
    Ujedinjeno Kraljevstvo 86444 Vodafone, Orange, 3, O2
    Brazil 40404 Nextel, TIM
    Haiti 40404 Digicel, Voila
    Irska 51210 Vodafone, O2
    Indija 53000 Bharti Airtel, Videocon, Reliance
    Indonezija 89887 AXIS, 3, Telkomsel, Indosat, XL Axiata
    Italija 4880804 Wind
    3424486444 Vodafone
    » Pogledajte SMS kratke šifre za druge zemlje

    Potvrda

     

    Dobro došli kući!

    Vremenska crta mjesto je na kojem ćete provesti najviše vremena i bez odgode dobivati novosti o svemu što vam je važno.

    Tweetovi vam ne valjaju?

    Prijeđite pokazivačem preko slike profila pa kliknite gumb Pratim da biste prestali pratiti neki račun.

    Kažite mnogo uz malo riječi

    Kada vidite Tweet koji volite, dodirnite srce – to osobi koja ga je napisala daje do znanja da vam se sviđa.

    Proširite glas

    Najbolji je način da podijelite nečiji Tweet s osobama koje vas prate prosljeđivanje. Dodirnite ikonu da biste smjesta poslali.

    Pridruži se razgovoru

    Pomoću odgovora dodajte sve što mislite o nekom tweetu. Pronađite temu koja vam je važna i uključite se.

    Saznajte najnovije vijesti

    Bez odgode pogledajte o čemu ljudi razgovaraju.

    Pratite više onoga što vam se sviđa

    Pratite više računa da biste dobivali novosti o temama do kojih vam je stalo.

    Saznajte što se događa

    Bez odgode pogledajte najnovije razgovore o bilo kojoj temi.

    Ne propustite nijedan aktualni događaj

    Bez odgode pratite kako se razvijaju događaji koje pratite.

    1. Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      For 2020 I'm doing a 1 C++ Best Practice per retweet thread! I wrote my first blog article about C++ best practices in 2007. In many ways I've been repeating myself over and over again for the last 13ish years. And very little of what I say is novel. Thread follows:

      8 replies 228 proslijeđenih tweetova 400 korisnika označava da im se sviđa
      Prikaži ovu nit
    2. Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      Even though I've been repeating many of the same best practices for a while, I think my style is relatively unique. One client told me "I like how you don't just give us a rule, you tell us why. <other guy> never gives us reasons."

      0 proslijeđenih tweetova 19 korisnika označava da im se sviđa
      Prikaži ovu nit
    3. Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      My goal as a trainer and a contractor (seems to be) to work myself out of a job. I want everyone to: 1. Learn how to experiment for themselves 2. Not just believe me, but test it 3. Learn how the language works 4. Stop making the same mistakes of the last generation

      1 reply 0 proslijeđenih tweetova 19 korisnika označava da im se sviđa
      Prikaži ovu nit
    4. Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      I'm thinking about changing my title from "C++ Trainer" to "C++ Guide." I *always* adapt my courses and material to the class I currently have. We might agree on X but I change it to Y half way through the first day to meet the needs of the organization.

      1 reply 0 proslijeđenih tweetova 11 korisnika označava da im se sviđa
      Prikaži ovu nit
    5. Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      Along the way we experiment and learn as a group. I often learn something also. Every group is unique, every class has new questions. But a lot of the questions are still the same ones over and over (to the point where I get to look like a mind reader, that bit's fun 😉)

      1 reply 0 proslijeđenih tweetova 14 korisnika označava da im se sviđa
      Prikaži ovu nit
    6. Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      So hence this thread (to spread the word on the long standing best practices). Retweet the main parent tweet to get the tread going! I'll try to provide a link for each Best Practice.

      0 proslijeđenih tweetova 9 korisnika označava da im se sviđa
      Prikaži ovu nit
      Jason Turner‏ @lefticus 7. sij
      • Prijavi Tweet

      1: `constexpr` everything known at compile time. Gone are the days of #define People over complicate `constexpr`, so let's break down the simplest thing. If you see something like (I've seen in real code): ``` static const std::vector<int> angles{-90,-45,0,45,90}; ```

      09:48 - 7. sij 2020.
      • 5 proslijeđenih tweetova
      • 37 oznaka „sviđa mi se”
      • Christian Lagares Alireza Hosseini Basit Ayantunde fendroid userrr3 Jeff Trull _agastya_ Sabragan 0x000david
      5 proslijeđenih tweetova 37 korisnika označava da im se sviđa
        1. Novi razgovor
        2. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          This really needs to be: ``` static constexpr std::array<int, 5> angles{-90,-45,0,45,90}; ``` The difference is beyond huge. https://godbolt.org/z/rQQnch  See also:https://www.youtube.com/watch?v=xtf9qkDTrZE …

          1 proslijeđeni tweet 45 korisnika označava da im se sviđa
          Prikaži ovu nit
        3. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          2: `const` Everything that's not `constexpr` Many people (like @gregcons and @JamesMcNellis ) have said this many times. This does 2 things: 1. It forces us to think about the initialization and lifetime of objects, which affects performance

          2 proslijeđena tweeta 30 korisnika označava da im se sviđa
          Prikaži ovu nit
        4. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          2. Communicates meaning to the readers of our code. And as an aside, if it's a static object the compiler is now free to move it into the constants portion of the binary, which can affect the optimizer as well.

          1 reply 0 proslijeđenih tweetova 20 korisnika označava da im se sviđa
          Prikaži ovu nit
        5. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          3: Follow the Rule of 0 https://en.cppreference.com/w/cpp/language/rule_of_three … No destructor is always better. Gives the compiler much more room for optimization. See also: https://www.youtube.com/watch?v=ayIJ4b6z-7g … `std::unique_ptr` can help with this, by providing a custom deleter.

          7 proslijeđenih tweetova 76 korisnika označava da im se sviđa
          Prikaži ovu nit
        6. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          4: If you must do manual resource management, follow the rule of 5 If you provide a destructor because `std::unique_ptr` doesn't make sense for your use case, you *must* `delete` `=default` or implement the other special member functions.

          1 reply 1 proslijeđeni tweet 22 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        7. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          Homework assignment: implement your own `unique_ptr`. It's hard to get it 100% right. Write tests. Understand why the defaulted special member functions don't work. Bonus points: implement it with C++20's `constexpr` dynamic allocation support.

          1 reply 0 proslijeđenih tweetova 19 korisnika označava da im se sviđa
          Prikaži ovu nit
        8. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          5: prefer scoped enums ``` enum Choices; enum OtherChoices ``` These two can easily get missed up and introduce things in the global namespace ``` enum class Choices enum class OtherChoices ``` cannot get mixed up without much effort.

          1 proslijeđeni tweet 23 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        9. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          @ciura_victor has given interesting stories about this in his CppCon talks about @ClangPowerTools Aside: `enum struct` and `enum class` are equivalent. Logically `enum struct` makes more sense, since they are public names. Which do you prefer?

          0 proslijeđenih tweetova 15 korisnika označava da im se sviđa
          Prikaži ovu nit
        10. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          6. Prefer algorithms over raw loops Algorithms communicate meaning and helps us apply the "`const` all the things" rule. In C++20 we get ranges, which make algorithms easier to use.

          1 reply 2 proslijeđena tweeta 28 korisnika označava da im se sviđa
          Prikaži ovu nit
        11. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          7. Prefer ranged-for loop syntax over old loops ``` for(int i = 0; i < container.size; ++i) { // oops mismatched types } ``` ``` for (auto itr = container.begin(); itr != container2.end(); ++itr) { // oops, most of us have done this at some point } ```

          1 reply 2 proslijeđena tweeta 19 korisnika označava da im se sviđa
          Prikaži ovu nit
        12. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          ``` for(const auto &element : container) { // eliminates both other problems } ```

          1 reply 0 proslijeđenih tweetova 20 korisnika označava da im se sviđa
          Prikaži ovu nit
        13. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          8. Use `auto` in ranged for loops ``` for (const int value : container_of_double) { // accidental conversion, possible warning } ``` ``` for (const base value : container_of_derived) { // accidental silent slicing } ```

          1 reply 1 proslijeđeni tweet 17 korisnika označava da im se sviđa
          Prikaži ovu nit
        14. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          ``` for (const auto &value : container) { // no possible accidental conversion } ```

          0 proslijeđenih tweetova 21 korisnik označava da mu se sviđa
          Prikaži ovu nit
        15. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          9. Don't Invoke Undefined Behavior @copperspice_cpp https://www.youtube.com/watch?v=XEXpwis_deQ … Ok, there's a lot that's UB and it's hard to keep track off, so we'll give some examples.

          2 proslijeđena tweeta 18 korisnika označava da im se sviđa
          Prikaži ovu nit
        16. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          10. Never test for `this` to be `nullptr`, it's UB ``` int Class::member() { if (this == nullptr) { // removed by the compiler, it would be UB return 42; } else { return 0; } } ```

          0 proslijeđenih tweetova 26 korisnika označava da im se sviđa
          Prikaži ovu nit
        17. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          People used to do this all the time, but it's always been UB. You cannot access an object outside its lifetime

          0 proslijeđenih tweetova 18 korisnika označava da im se sviđa
          Prikaži ovu nit
        18. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          11. Never test for a `&` to be `nullptr`, it's UB ``` int get_value(int &thing) { if (&thing == nullptr) { // removed by compiler return 42; } else { return thing; } } ``` It's UB to make a null reference, don't try it. Always assume a `&` is a value object.

          1 reply 0 proslijeđenih tweetova 30 korisnika označava da im se sviđa
          Prikaži ovu nit
        19. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          "valid" not "value" object

          0 proslijeđenih tweetova 11 korisnika označava da im se sviđa
          Prikaži ovu nit
        20. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          12. Use the tools: sanitizers Address sanitizer, UB Sanitizer, Thread sanitizer can find many issues almost like magic. @johnregehr recommends always enabling asan and ubsan during development.

          3 proslijeđena tweeta 35 korisnika označava da im se sviđa
          Prikaži ovu nit
        21. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          13: Use the tools: compiler warnings You have many many warnings you are not using, most of them beneficial. -Wall is *not* all -Wextra is still barely scratching the surface!https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md#compilers …

          1 reply 2 proslijeđena tweeta 29 korisnika označava da im se sviđa
          Prikaži ovu nit
        22. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          14: Use the tools: static analysis cppcheck and clang-tidy are free and have integration with every IDE and editor today.

          3 proslijeđena tweeta 22 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        23. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          15: Use the tools: continuous builds If your project is not automatically tested regularly you will not be able to maintain quality. If you don't require 100% tests passing you will never know what state the code is in.

          1 reply 0 proslijeđenih tweetova 23 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        24. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          16. Use the tools: multiple compilers Support *at least* 2 compilers on your platform. Each compiler does different analysis.

          1 reply 1 proslijeđeni tweet 24 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        25. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          17. Use the tools: automated tests You need a single command to run tests. If you don't have that your tests will not be run. * catch2 * ctest * doctest * gtest * boost::test You need to be familiar with these tools, what they do and pick from them.

          2 proslijeđena tweeta 23 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        26. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          18. Use the tools: build generators * cmake * meson * etc Raw make files or visual studio project files make each of the things listed above too difficult to implement. Use a build tool to help you with maintaining portability across platforms and compilers.

          1 reply 2 proslijeđena tweeta 17 korisnika označava da im se sviđa
          Prikaži ovu nit
        27. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          19: Use the tools: Package managers * vcpkg * conan @conan_io * hunter * etc Also help with maintaining portability and reducing load on the developers. Videos here:https://www.youtube.com/watch?v=9cCQHJ-cNHY&list=PLs3KjaCtOwSZ2tbuV1hx8Xz-rFZTan2J1&index=118 …

          1 reply 3 proslijeđena tweeta 18 korisnika označava da im se sviđa
          Prikaži ovu nit
        28. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          20: Prefer `auto` in many cases. First off, I'm not an Almost Always Auto person, but let me ask you this: What is the type of `std::count`?

          1 reply 1 proslijeđeni tweet 4 korisnika označavaju da im se sviđa
          Prikaži ovu nit
        29. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          My answer is "I don't care." ``` const auto result = std::count( /* stuff */ ); ``` avoids unnecessary conversions and data loss. Same as ranged-for loops. Also, `auto` requires initialization, same as `const`, same reasoning for why that's good.

          1 proslijeđeni tweet 11 korisnika označava da im se sviđa
          Prikaži ovu nit
        30. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          21: Constrain your template parameters with concepts (C++20) This will result in better error messages (eventually) and better compile times than SFINAE. Besides much more readable code than SFINAE.https://www.youtube.com/watch?v=dR64GQb4AGo …

          1 reply 0 proslijeđenih tweetova 11 korisnika označava da im se sviđa
          Prikaži ovu nit
        31. Jason Turner‏ @lefticus 7. sij
          • Prijavi Tweet

          22: Prefer `if constexpr` over SFINAE See #21. SFINAE is kind of write-only code. `if constexpr` doesn't have all the same flexibility, but use it when you can. See Practical C++17https://www.youtube.com/watch?v=YePHP4aIc1g …

          1 reply 0 proslijeđenih tweetova 12 korisnika označava da im se sviđa
          Prikaži ovu nit
        32. Još 26 drugih odgovora

      Čini se da učitavanje traje već neko vrijeme.

      Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.

        Sponzorirani tweet

        false

        • © 2020 Twitter
        • O Twitteru
        • Centar za pomoć
        • Uvjeti
        • Pravila o privatnosti
        • Imprint
        • Kolačići
        • Informacije o oglasima