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

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

ความคิดเห็น • 101

  • @cppweekly
    @cppweekly  2 หลายเดือนก่อน +38

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

    • @mytech6779
      @mytech6779 2 หลายเดือนก่อน

      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 หลายเดือนก่อน +10

    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 หลายเดือนก่อน +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

  • @not_ever
    @not_ever 2 หลายเดือนก่อน +27

    @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 2 หลายเดือนก่อน +13

      sometimes you need to flush multiple times

    • @luizkruger7425
      @luizkruger7425 หลายเดือนก่อน

      Sorry, it was a double flusher

  • @dorquemadagaming3938
    @dorquemadagaming3938 หลายเดือนก่อน +5

    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...

    • @ostrogonov
      @ostrogonov 3 วันที่ผ่านมา

      Nowadays it is very common to merge C and asm code in new Spectrum games (a lot of new ones every year), but not so using C++, due to memory restrictions..

  • @N....
    @N.... 2 หลายเดือนก่อน +6

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

  • @frydac
    @frydac 2 หลายเดือนก่อน +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.

    • @cppweekly
      @cppweekly  หลายเดือนก่อน

      Go to a book store or a grocery store with a magazine aisle. There are still plenty of high quality magazines being published.

  • @DavidPlass
    @DavidPlass หลายเดือนก่อน

    4:32 love the upper case keywords...

  • @felineboy
    @felineboy 2 หลายเดือนก่อน +20

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

    • @herrdingenz6295
      @herrdingenz6295 2 หลายเดือนก่อน +4

      or use less AI^^

    • @mytech6779
      @mytech6779 2 หลายเดือนก่อน +4

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

    • @herrdingenz6295
      @herrdingenz6295 2 หลายเดือนก่อน +1

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

    • @mytech6779
      @mytech6779 2 หลายเดือนก่อน

      @@herrdingenz6295 🤔→↑↑←🤨

    • @jbs.
      @jbs. หลายเดือนก่อน

      They need both and more.

  • @benjaminshinar9509
    @benjaminshinar9509 หลายเดือนก่อน

    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.

    • @cppweekly
      @cppweekly  หลายเดือนก่อน

      These were two different magazines with two different names from two different publishers. There is no indication at all that they are different editions of the same book.

    • @Ascania
      @Ascania หลายเดือนก่อน

      @@cppweekly Both publishing companies, Papercut and (now defunct) BlackDog Media (BDM) have the same owners and board and used to be registered at the same address (before BDM had to change due to insolvency proceedings). In practice, were the publisher any bigger those would just be two imprints used by one company. And even with that said, you are forgetting that freelance writers often work with several publishers and they can easily have commissioned articles what is essentially the same topic from the same authors

  • @carlslater7492
    @carlslater7492 หลายเดือนก่อน +4

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

  • @mogenshansen7210
    @mogenshansen7210 หลายเดือนก่อน +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 TH-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 TH-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

  • @aloluk
    @aloluk หลายเดือนก่อน

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

  • @jose_braga
    @jose_braga 2 หลายเดือนก่อน +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 หลายเดือนก่อน +4

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

    • @herrdingenz6295
      @herrdingenz6295 2 หลายเดือนก่อน +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 2 หลายเดือนก่อน +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 หลายเดือนก่อน +3

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

    • @mytech6779
      @mytech6779 2 หลายเดือนก่อน +2

      …`

  • @DrCoyne
    @DrCoyne หลายเดือนก่อน

    This channel is amazing.

  • @headlibrarian1996
    @headlibrarian1996 หลายเดือนก่อน +1

    I still have copies of C Users Journal.

  • @herrdingenz6295
    @herrdingenz6295 2 หลายเดือนก่อน +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 2 หลายเดือนก่อน +3

      Isn't modern CRT ok with void main?

    • @not_ever
      @not_ever 2 หลายเดือนก่อน +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 2 หลายเดือนก่อน +4

      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 หลายเดือนก่อน +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 2 หลายเดือนก่อน +4

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

  • @willo2222
    @willo2222 หลายเดือนก่อน

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

  • @bobbob-gi1yp
    @bobbob-gi1yp หลายเดือนก่อน

    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.

    • @cppweekly
      @cppweekly  หลายเดือนก่อน

      It's a bad habit because it includes an implicit flush

  • @literallynull
    @literallynull 2 หลายเดือนก่อน +7

    I wonder how would an IT PlayBoy look like

  • @ssbmoro
    @ssbmoro หลายเดือนก่อน

    i didn't realize magazines were still published in 2019

    • @cppweekly
      @cppweekly  หลายเดือนก่อน

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

  • @DFJ-m7b
    @DFJ-m7b 2 หลายเดือนก่อน +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.

  • @LaserFur
    @LaserFur หลายเดือนก่อน

    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 หลายเดือนก่อน

      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 หลายเดือนก่อน

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

    • @LaserFur
      @LaserFur หลายเดือนก่อน

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

  • @NotMarkKnopfler
    @NotMarkKnopfler 2 หลายเดือนก่อน +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 2 หลายเดือนก่อน +4

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

    • @mytech6779
      @mytech6779 2 หลายเดือนก่อน +5

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

    • @WilhelmDrake
      @WilhelmDrake 2 หลายเดือนก่อน +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 2 หลายเดือนก่อน +1

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

  • @YTonYahoo
    @YTonYahoo 2 หลายเดือนก่อน +2

    Interesting

  • @steevf
    @steevf 2 หลายเดือนก่อน +11

    That first mag feels like it was AI generated.

    • @herrdingenz6295
      @herrdingenz6295 2 หลายเดือนก่อน +1

      so was the 2nd one^^

    • @steevf
      @steevf 2 หลายเดือนก่อน +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 2 หลายเดือนก่อน +1

      @@steevf AI writing beginners guides .. lol

    • @steevf
      @steevf 2 หลายเดือนก่อน +1

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

    • @geoffsmith82
      @geoffsmith82 หลายเดือนก่อน +1

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

  • @rinner2801
    @rinner2801 หลายเดือนก่อน

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

  • @oof-software
    @oof-software 2 หลายเดือนก่อน +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 หลายเดือนก่อน +3

      compilers have always been free

    • @anon_y_mousse
      @anon_y_mousse 2 หลายเดือนก่อน

      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.

  • @ibrahimtopcu1043
    @ibrahimtopcu1043 หลายเดือนก่อน +1

    Waste of money, thanks for showing it.

    • @ibrahimtopcu1043
      @ibrahimtopcu1043 หลายเดือนก่อน +2

      forgot to mention, it is also waste of paper

  • @master138
    @master138 หลายเดือนก่อน +2

    int i;
    i = 5;
    Bro💀

  • @toxicore1190
    @toxicore1190 หลายเดือนก่อน

    2019? at least its not chatgpt..

  • @johnjakson444
    @johnjakson444 หลายเดือนก่อน

    its just a money grab aimed at poorer students thinking a magazine is going to get them a software job, and C++ Maths, only Brits say Maths
    maybe its a pickup thing, if guy is holding one of these, the pretty girl across the seat will think, wow a programmer, must be smart, wonder if....

  • @Yacine-e9p
    @Yacine-e9p หลายเดือนก่อน

    A

  • @anon_y_mousse
    @anon_y_mousse 2 หลายเดือนก่อน +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.

    • @cppweekly
      @cppweekly  หลายเดือนก่อน

      > suggest you stop naming things the same as the standard library things
      So you suggest never updating compilers, changing operating systems, changing std versions?
      It's effectively unknowable what's in the std namespace because of implementation differences

    • @anon_y_mousse
      @anon_y_mousse หลายเดือนก่อน

      @@cppweekly Like I said, either avoid the naming conflicts by more wisely choosing names, as you can predict where things will go, especially if you keep up with the standard committees, or put your own code into your own namespace.

  • @b0570nk4
    @b0570nk4 หลายเดือนก่อน

    lol

  • @happygofishing
    @happygofishing 2 หลายเดือนก่อน

    SAAAR!

  • @romanemul1
    @romanemul1 2 หลายเดือนก่อน +2

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

    • @matgat
      @matgat 2 หลายเดือนก่อน +13

      Beginners deserve to read good quality material, not that crap

    • @ohwow2074
      @ohwow2074 2 หลายเดือนก่อน +4

      Beginners can get confused with this shite.

    • @romanemul1
      @romanemul1 2 หลายเดือนก่อน

      @@matgat Well then explain this to them.

    • @herrdingenz6295
      @herrdingenz6295 2 หลายเดือนก่อน +5

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

    • @romanemul1
      @romanemul1 2 หลายเดือนก่อน

      @@ohwow2074 confused on what ?

  • @konstantin2296
    @konstantin2296 หลายเดือนก่อน

    Geeksforgeeks looks like a decent resource after that 😅