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.
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.
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
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.
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...
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 ?
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
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.
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; };
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.
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 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'.
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.
@@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
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 😊
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
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.
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.
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?
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).
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.
Anywhere I accidentally say 2014 in reference to the newer magazine, I meant 2024
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.
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.
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
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.
@10:10 Using endl in a loop is surely the absolute best place to use endl. Who doesn't love repeatedly calling flush?
sometimes you need to flush multiple times
Sorry, it was a double flusher
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...
"Extra semicolons" probably refers to accidentally turning control blocks into unconditional blocks
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 ?
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
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.
Maybe those magazines should hire less graphic designers and more programmers.
or use less AI^^
@@herrdingenz6295 In 2019? You seem to pay attention less than the graphics designers that made those screenshots too small to read.
@@mytech6779 ouch that hurt 🤒may your compiler be with you!!!
@@herrdingenz6295 🤔→↑↑←🤨
They need both and more.
Bring back Dr. Dobbs Journal of Computer Calisthenics & Orthodontia ..... Running Light Without Overbyte!
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; };
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.
@the_real_glabnurb it prevents a else after a block of comments.I am dealing with a lot of old legacy code.
@the_real_glabnurb it also prevents a macro function with more than one internal function call from messing up.
@6:05 there is an auto pi = 3.14 in step 9 you say they introduce it later.
This channel is amazing.
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?
Isn't modern CRT ok with void main?
@@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'.
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.
@@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
@@minirop i bet many different people wrote those examples, or they used some stupid AI :D
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 😊
My preference is to add a flush explicitly if that's what is needed. It makes the intent clearer.
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
Depending on your situation: Detect if you're running in a non-interactive shell/terminal/session and set stdout to be unbuffered.
@@sledgex9 so basically write your own logger, or use proper libs like spdlog etc.
…`
I still have copies of C Users Journal.
Having `const` ints and `#define`d doubles smells like trying to ensure constant expressions in a C++98 program.
I wonder how would an IT PlayBoy look like
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.
i didn't realize magazines were still published in 2019
Go to any bookstore, grocery store and you will find a magazine section somewhere.
This is one of my hobbies while traveling
Interesting
11:32 The comma operator goes into action, so the program outputs 10 only. I have seen one python programmer making the same mistake.
That first mag feels like it was AI generated.
so was the 2nd one^^
@@herrdingenz6295 Yeah the second one looked like a reprint of the first one for a different market as they were internally identical.
@@steevf AI writing beginners guides .. lol
@@herrdingenz6295 and doing it very poorly to boot. go AI! HAHAHA! I hate AI crap.😒
except AI wasn't around back then that could do that!
int i;
i = 5;
Bro💀
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.
compilers have always been free
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.
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?
Is this the one who submitted an AI generated "paper" and tried to pass it off as a serious paper?
@@sledgex9 No, this did not involve AI generated papers.
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).
@@sledgex9If you think that AI can produce what he has, it shows why you are siding with delusional people.
Was it written or edited by AI, I wonder? ;)
Waste of money, thanks for showing it.
forgot to mention, it is also waste of paper
2019? at least its not chatgpt..
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.
lol
SAAAR!
A
well those mags are for beginners not for big boys like you.
Beginners deserve to read good quality material, not that crap
Beginners can get confused with this shite.
@@matgat Well then explain this to them.
well .. beginners should get good learning material, right?^^
@@ohwow2074 confused on what ?
Geeksforgeeks looks like a decent resource after that 😅