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

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 92

  • @cppweekly
    @cppweekly  9 днів тому +33

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

    • @mytech6779
      @mytech6779 9 днів тому

      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.

  • @xavierthomas1980
    @xavierthomas1980 8 днів тому +8

    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 8 днів тому +1

      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 9 днів тому +11

    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.

  • @not_ever
    @not_ever 9 днів тому +22

    @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 днів тому +11

      sometimes you need to flush multiple times

    • @luizkruger7425
      @luizkruger7425 23 години тому

      Sorry, it was a double flusher

  • @dorquemadagaming3938
    @dorquemadagaming3938 7 днів тому +1

    4:43 this is Z80 assembly, and most certainly for ZX Spectrum. Here they clear the screen by filling it with 6KiB of zeros, and then copy some color attributes - definitely Speccy screen layout. What is it doing in a C++ magazine remains a mystery, as C++ came to existence only years later...

  • @N....
    @N.... 9 днів тому +5

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

  • @mogenshansen7210
    @mogenshansen7210 8 днів тому +5

    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 UA-cam 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 UA-cam 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 ?

    • @__Brandon__
      @__Brandon__ День тому

      They can start by cranking the compiler warnings up and getting clang tidy with some sensible warnings enabled. That alone is enough to guide you in the right direction all the way up until algorithm selection

  • @benjaminshinar9509
    @benjaminshinar9509 5 днів тому

    I remember hearing once an un-official rule that a new edition of an educational book can only differ in 10% of the content, so the focus goes to adding new material and fixing glaring issues, rather than having a consistent style or voice across the book.
    it's pretty likely that the technical team is just a couple of students each doing a few topics by copying examples from g4g and one another.

  • @felineboy
    @felineboy 9 днів тому +17

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

    • @herrdingenz6295
      @herrdingenz6295 9 днів тому +4

      or use less AI^^

    • @mytech6779
      @mytech6779 9 днів тому +4

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

    • @herrdingenz6295
      @herrdingenz6295 9 днів тому +1

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

    • @mytech6779
      @mytech6779 9 днів тому

      @@herrdingenz6295 🤔→↑↑←🤨

    • @jbs.
      @jbs. 8 днів тому

      They need both and more.

  • @carlslater7492
    @carlslater7492 7 днів тому +3

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

  • @LaserFur
    @LaserFur 7 днів тому

    12:31 I'm an old programmer and I add extra semicolons all over the place. I've found bugs by adding semicolons and replacing "if (x) y;" with "if (x) { y; };

    • @the_real_glabnurb
      @the_real_glabnurb 3 дні тому

      As a not so old programmer, your added semicolon is completely useless, if(x){y;} will work just as fine.
      What you really did is highlight the fact that y; is the body of the conditional clause and so could better find logical bugs.

    • @LaserFur
      @LaserFur 3 дні тому

      @the_real_glabnurb it prevents a else after a block of comments.I am dealing with a lot of old legacy code.

    • @LaserFur
      @LaserFur 3 дні тому

      @the_real_glabnurb it also prevents a macro function with more than one internal function call from messing up.

  • @aloluk
    @aloluk 8 днів тому

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

  • @DrCoyne
    @DrCoyne 7 днів тому

    This channel is amazing.

  • @herrdingenz6295
    @herrdingenz6295 9 днів тому +11

    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 9 днів тому +3

      Isn't modern CRT ok with void main?

    • @not_ever
      @not_ever 9 днів тому +7

      @@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 9 днів тому +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 9 днів тому +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 9 днів тому +4

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

  • @jose_braga
    @jose_braga 9 днів тому +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 9 днів тому +3

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

    • @herrdingenz6295
      @herrdingenz6295 9 днів тому +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 9 днів тому +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 9 днів тому +3

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

    • @mytech6779
      @mytech6779 9 днів тому +2

      …`

  • @headlibrarian1996
    @headlibrarian1996 7 днів тому

    I still have copies of C Users Journal.

  • @willo2222
    @willo2222 8 днів тому

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

  • @literallynull
    @literallynull 9 днів тому +6

    I wonder how would an IT PlayBoy look like

  • @bobbob-gi1yp
    @bobbob-gi1yp 3 дні тому

    Why not use endl?

    •  День тому

      Because it does a call to flush on the output stream, thus negating any output buffering. i.e, really bad for performance if done repeatedly.

  • @ssbmoro
    @ssbmoro 3 дні тому

    i didn't realize magazines were still published in 2019

    • @cppweekly
      @cppweekly  3 дні тому

      Go to any bookstore, grocery store and you will find a magazine section somewhere.
      This is one of my hobbies while traveling

  • @YTonYahoo
    @YTonYahoo 9 днів тому +2

    Interesting

  • @DFJ-m7b
    @DFJ-m7b 9 днів тому +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.

  • @steevf
    @steevf 9 днів тому +11

    That first mag feels like it was AI generated.

    • @herrdingenz6295
      @herrdingenz6295 9 днів тому +1

      so was the 2nd one^^

    • @steevf
      @steevf 9 днів тому +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 9 днів тому +1

      @@steevf AI writing beginners guides .. lol

    • @steevf
      @steevf 9 днів тому +1

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

    • @geoffsmith82
      @geoffsmith82 3 дні тому

      except AI wasn't around back then that could do that!

  • @master138
    @master138 8 днів тому +2

    int i;
    i = 5;
    Bro💀

  • @oof-software
    @oof-software 9 днів тому +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 9 днів тому +3

      compilers have always been free

    • @anon_y_mousse
      @anon_y_mousse 9 днів тому

      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 9 днів тому +11

    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 9 днів тому +4

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

    • @mytech6779
      @mytech6779 9 днів тому +5

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

    • @WilhelmDrake
      @WilhelmDrake 9 днів тому +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 9 днів тому +1

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

  • @rinner2801
    @rinner2801 2 дні тому

    Was it written or edited by AI, I wonder? ;)

  • @ibrahimtopcu1043
    @ibrahimtopcu1043 8 днів тому

    Waste of money, thanks for showing it.

    • @ibrahimtopcu1043
      @ibrahimtopcu1043 8 днів тому +1

      forgot to mention, it is also waste of paper

  • @toxicore1190
    @toxicore1190 2 дні тому

    2019? at least its not chatgpt..

  • @anon_y_mousse
    @anon_y_mousse 9 днів тому +1

    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.

  • @b0570nk4
    @b0570nk4 8 днів тому

    lol

  • @happygofishing
    @happygofishing 9 днів тому

    SAAAR!

  • @Yacine-e9p
    @Yacine-e9p 8 днів тому

    A

  • @romanemul1
    @romanemul1 9 днів тому +2

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

    • @matgat
      @matgat 9 днів тому +12

      Beginners deserve to read good quality material, not that crap

    • @ohwow2074
      @ohwow2074 9 днів тому +4

      Beginners can get confused with this shite.

    • @romanemul1
      @romanemul1 9 днів тому

      @@matgat Well then explain this to them.

    • @herrdingenz6295
      @herrdingenz6295 9 днів тому +5

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

    • @romanemul1
      @romanemul1 9 днів тому

      @@ohwow2074 confused on what ?

  • @konstantin2296
    @konstantin2296 5 днів тому

    Geeksforgeeks looks like a decent resource after that 😅