C++ Weekly - Ep 457 - I Read C++ Magazines (So you don't have to!)

Поделиться
HTML-код
  • Опубликовано: 3 дек 2024

Комментарии •

  • @cppweekly
    @cppweekly  День назад +26

    Anywhere I accidentally say 2014 in reference to the newer magazine, I meant 2024

    • @mytech6779
      @mytech6779 День назад

      Some publishing software/font combinations automatically render double quotes as open-close style even though the underlying char typed in was 0x42,
      I don't know if it is only at the format/rendering layer or if it converts the ascii quotes into corresponding unicode open-close code points in the saved file text.

  • @not_ever
    @not_ever День назад +18

    @10:10 Using endl in a loop is surely the absolute best place to use endl. Who doesn't love repeatedly calling flush?

    • @pyyrr
      @pyyrr День назад +9

      sometimes you need to flush multiple times

  • @xavierthomas1980
    @xavierthomas1980 День назад +3

    Well, at least they made the reader investigate the comma operator. I guess it will become useful later in their life when they will need to fold a variadic parameter pack in order to call multiple lambda expressions.

    • @garthor
      @garthor 12 часов назад

      I had to test it myself with the cout statement using an online compiler, because I wasn't sure what it would do.
      Every compiler I tested it on, on godbolt seems to let you do it, but only clang produces a warning (so far, by default)...
      The output is just whatever the first number is, because `std::cout

  • @frydac
    @frydac День назад +8

    I can't remember the last time I bought a magazine.
    These day's I would expect a scam indeed as I would expect it is impossible to publish quality content like that and make any money.
    I would consider these the last convulsions of an already dead industry. The rise of digital media and the shift to online platforms have made it nearly impossible for traditional print magazines to survive, especially without resorting to gimmicks or aggressive monetization tactics. It's a shame because some of them used to offer genuinely insightful and well-curated content.

    • @riley-arr-g
      @riley-arr-g День назад +1

      It's a shame indeed. I'd love descent published hardcopy to bind and store.

  • @DFJ-m7b
    @DFJ-m7b День назад +2

    11:32 The comma operator goes into action, so the program outputs 10 only. I have seen one python programmer making the same mistake.

  • @N....
    @N.... День назад +2

    "Extra semicolons" probably refers to accidentally turning control blocks into unconditional blocks

  • @jose_braga
    @jose_braga День назад +4

    I've been bitten once by using `
    ` instead of `endl` in my job. Our cloud app running in kubernetes was not printing the logs as they were happening. Because events were scarse, we spent days looking why our backend was not handling txns, when finally.. we replaced
    with endl and it all started logging OK
    What could I have done differently? Thanks 😊

    • @phredrix-we7ks
      @phredrix-we7ks День назад +2

      My preference is to add a flush explicitly if that's what is needed. It makes the intent clearer.

    • @herrdingenz6295
      @herrdingenz6295 День назад +1

      well .. the issue there was that
      doesn't flush the output and writes it while std::endl does .. but when logging stuff you would prefer
      cause you don't want to force-flush the output everytime you add some output .. for performance reasons

    • @sledgex9
      @sledgex9 День назад +1

      Depending on your situation: Detect if you're running in a non-interactive shell/terminal/session and set stdout to be unbuffered.

    • @herrdingenz6295
      @herrdingenz6295 День назад +2

      @@sledgex9 so basically write your own logger, or use proper libs like spdlog etc.

    • @mytech6779
      @mytech6779 День назад +1

      …`

  • @herrdingenz6295
    @herrdingenz6295 День назад +10

    2:49 you didn't even notice the "void main()" which actually should be "int main()" :D
    7:48 wouldn't it be better to do '
    ' instead of "
    " when putting a single char?

    • @literallynull
      @literallynull День назад +3

      Isn't modern CRT ok with void main?

    • @not_ever
      @not_ever День назад +6

      @@literallynull
      The C runtime may be (if that's the CRT you are referring to) but this is from the C++ standard:
      An implementation shall not predefine the main function. Its type shall have C++ language linkage and
      it shall have a declared return type of type int, but otherwise its type is implementation-defined. An
      implementation shall allow both
      - a function of () returning int and
      - a function of (int, pointer to pointer to char) returning int
      In practice, some compilers may allow void main() but it probably just ignores the void and carries on as normal. From a quick check on godbolt MSVC will ignore your void and return 0 (if I'm reading the assembly correctly) but clang and gcc do not compile and tell you error: 'main' must return 'int'.

    • @minirop
      @minirop День назад +3

      I also love all the different versions of PI. first is auto, next is double, after that it's M_PI and at the end it's #define.
      You have to love the consistency and the order.

    • @herrdingenz6295
      @herrdingenz6295 День назад +2

      @@literallynull AFAIK the "main" function should return an int (the error code) .. for a magazine showing people how to write c++ code it is weird that in their first example it returns "void" but in all other examples they do "int main()" :D

    • @herrdingenz6295
      @herrdingenz6295 День назад +4

      @@minirop i bet many different people wrote those examples, or they used some stupid AI :D

  • @felineboy
    @felineboy День назад +13

    Maybe those magazines should hire less graphic designers and more programmers.

    • @herrdingenz6295
      @herrdingenz6295 День назад +3

      or use less AI^^

    • @mytech6779
      @mytech6779 День назад +3

      @@herrdingenz6295 In 2019? You seem to pay attention less than the graphics designers that made those screenshots too small to read.

    • @herrdingenz6295
      @herrdingenz6295 День назад +1

      @@mytech6779 ouch that hurt 🤒may your compiler be with you!!!

    • @mytech6779
      @mytech6779 День назад

      @@herrdingenz6295 🤔→↑↑←🤨

    • @jbs.
      @jbs. 20 часов назад

      They need both and more.

  • @aloluk
    @aloluk День назад

    @6:05 there is an auto pi = 3.14 in step 9 you say they introduce it later.

  • @carlslater7492
    @carlslater7492 2 часа назад

    Bring back Dr. Dobbs Journal of Computer Calisthenics & Orthodontia ..... Running Light Without Overbyte!

  • @headlibrarian1996
    @headlibrarian1996 2 часа назад

    I still have copies of C Users Journal.

  • @willo2222
    @willo2222 День назад

    Having `const` ints and `#define`d doubles smells like trying to ensure constant expressions in a C++98 program.

  • @oof-software
    @oof-software День назад +6

    Thinking back, I'm very grateful that compilers are mostly free nowadays, I think they were mostly payware and maybe even only accessible to enterprises back then.

    • @herrdingenz6295
      @herrdingenz6295 День назад +2

      compilers have always been free

    • @RalfPinkaire-f7w
      @RalfPinkaire-f7w День назад

      ​​@@herrdingenz6295no they haven't. There were plenty of paid for. Some were free.

    • @anon_y_mousse
      @anon_y_mousse День назад

      Back in the 90's the best compilers were paid enterprise software, but you could still get compilers for literally every programming language for free. I used LCC-Win32 back then as it was the best free C compiler for Windows, and since I moved to Linux exclusively I've only used gcc for C and g++ for C++ as GNU's compilers are IMO the best, even above the paid enterprise compilers.

  • @NotMarkKnopfler
    @NotMarkKnopfler День назад +10

    Wondering what your opinion is on the recent expulsion of a c++ standards committee member for using the wrong title in paper submitted to the standards committee?

    • @sledgex9
      @sledgex9 День назад +3

      Is this the one who submitted an AI generated "paper" and tried to pass it off as a serious paper?

    • @mytech6779
      @mytech6779 День назад +5

      @@sledgex9 No, this did not involve AI generated papers.

    • @WilhelmDrake
      @WilhelmDrake День назад +1

      This was ridiculous! The guy was kicked out because he used the word "question"! The word police have gotten out of control. They are doing serious harm to and jeopardizing the future of C++. I'm getting sick of these people (ie: the word police).

    • @helbert2a
      @helbert2a День назад +1

      ​@@sledgex9If you think that AI can produce what he has, it shows why you are siding with delusional people.

  • @steevf
    @steevf День назад +10

    That first mag feels like it was AI generated.

    • @herrdingenz6295
      @herrdingenz6295 День назад +1

      so was the 2nd one^^

    • @steevf
      @steevf День назад +2

      @@herrdingenz6295 Yeah the second one looked like a reprint of the first one for a different market as they were internally identical.

    • @herrdingenz6295
      @herrdingenz6295 День назад +1

      @@steevf AI writing beginners guides .. lol

    • @steevf
      @steevf День назад +1

      @@herrdingenz6295 and doing it very poorly to boot. go AI! HAHAHA! I hate AI crap.😒

  • @YTonYahoo
    @YTonYahoo День назад +2

    Interesting

  • @literallynull
    @literallynull День назад +6

    I wonder how would an IT PlayBoy look like

  • @mogenshansen7210
    @mogenshansen7210 23 часа назад

    I think that the real problem is, how can a newcommer know which information and sources to trust - regardless of whether it is a magazine, a book or a RUclips channel ?
    As an expert it is fairly easy to know this channel has a very high degree of credibility and quality.
    There are however many RUclips channel, that teaches C++, whuch seem credible but are actually often wrong or at last suboptimal.
    I have a book from a very well know author (in some parts of the world), that are used in universities and sold in large numbers. There is not at single correct example in the book (main returns void). Ignoring that, the subjects and order are just bad.
    But how can the students know, when that is the book that the university classes are using ?

  • @ibrahimtopcu1043
    @ibrahimtopcu1043 19 часов назад

    Waste of money, thanks for showing it.

    • @ibrahimtopcu1043
      @ibrahimtopcu1043 19 часов назад

      forgot to mention, it is also waste of paper

  • @happygofishing
    @happygofishing День назад

    SAAAR!

  • @master138
    @master138 День назад

    int i;
    i = 5;
    Bro💀

  • @Yacine-e9p
    @Yacine-e9p День назад

    A

  • @b0570nk4
    @b0570nk4 День назад

    lol

  • @anon_y_mousse
    @anon_y_mousse День назад

    Personally, I completely agree with `using namespace std;` and would instead suggest that you just stop naming things the same as the standard library things and/or put your own same name stuff into your own namespace. I also applaud their telling people about Dev-C++ as it's a vastly under-recommended IDE choice. And I would even go so far as to suggest that languages should strive for more Unicode compatibility. I love the idea of having proper open and close quote characters which would allow for perfect nesting without escaping quotes.
    All the rest, totally agreed, garbage examples.

  • @romanemul1
    @romanemul1 День назад +1

    well those mags are for beginners not for big boys like you.

    • @matgat
      @matgat День назад +10

      Beginners deserve to read good quality material, not that crap

    • @ohwow2074
      @ohwow2074 День назад +4

      Beginners can get confused with this shite.

    • @romanemul1
      @romanemul1 День назад

      @@matgat Well then explain this to them.

    • @herrdingenz6295
      @herrdingenz6295 День назад +4

      well .. beginners should get good learning material, right?^^

    • @romanemul1
      @romanemul1 День назад

      @@ohwow2074 confused on what ?