a) Yes. C++ has more information available for optimization.
eg. The compiler writer can optimize the compiler for std::vector rather than trying to optimize for every conceivable way a C programmer could mess around with pointers.
b) Yes. C++ makes it far easier to change data structures and optimize the code for different architectures than C does.
eg. Look at strcmp() vs wcscmp(). In C you need to choose a function name in advance. If you've got a bunch of legacy code to convert then how do you update it? With a macro? C++ has templates function overloading so it's much easier to adapt code to new data types.
Also new programming practices are much easier to implement.
eg. Updating code to to use strncpy() instead of strcpy(). It's going to be a lot of work to adapt a large C program to do that. If you're using a string class which defines operator=() for string copy then you change a few lines of code, job done.
Ok, I personally stopped coding in asm and switched to C because the processors got so complicated that a compiler would have a higher chance of creating faster code and so that porting the code between architectures would no longer require a complete rewrite of the whole program line by line. How would your C++ compiler be any better than a C compiler for any of that?
You're supposed to start by telling me that C is somehow better than C++, not that C is better than assembly language.:-)
So you use C++ because the compiler is better at optimizing for pipelines and cachelines than C compilers? Are you sure? Because that is why I don't code in asm anymore.
You're supposed to start with a "C vs. C++" comparison. I'm the one who converts it into a "C vs assembly language" comparison.:-)
SEGV is very unlikely if you're using C++ correctly, ie. std::containers, std::string and strong/weak smart pointers. Any bad access can be trapped just like in Java.
Exceptions in a destructor? Also very esoteric. Destructors are there to free resources not to make decisions.
Yeah, the whole "compile-link" thing with separate headers is a bit 1970s.
It does work though and when I look at the sheer number of files/folders languages like Java produce then I'm not sure there's a much better replacement.
There's no need: C++ has modtly caught up to Ada and has far better IDEs and compilers. All you need to do is stop using the "C" part and you're golden.
C++ isn't C. If I open Visual C++ and type this code I'll get an exception when I try to run it: std::vector a; a[-1] = 0x666;
So next time you hear Linus Torvalds rant against C++ tell him to fuck off and stop being an idiot.
Yep. Too much 'critical' code is written by the boss's nephew just because he "seems to be good at computers".
Bjarne said it best:
The idea of programming as a semiskilled task, practiced by people with a few months' training, is dangerous. We wouldn't tolerate plumbers or accountants that poorly educated. We don't have as an aim that architecture (of buildings) and engineering (of bridges and trains) should become more accessible to people with progressively less training. Indeed, one serious problem is that currently, too many software developers are undereducated and undertrained. Obviously, we don't want our tools--including our programming languages--to be more complex than necessary. But one aim should be to make tools that will serve skilled professionals--not to lower the level of expressiveness to serve people who can hardly understand the problems, let alone express solutions. We can and do build tools that make simple tasks simple for more people, but let's not let most people loose on the infrastructure of our technical civilization or force the professionals to use only tools designed for amateurs. - Bjarne
I noticed that as well but I figured it was just for the photo-shoot. The handle isn't clean enough for it to be raised/lowered very often and they have to be loading the BASIC from somewhere.
Can you explain how you are attacked by CF ip addresses? I'm a CF customer but can't see how CF could attack you.
Hackers must be spoofing their addresses so they look like they come from Cloudflare. People don't want to block Cloudflare so that makes them harder to filter.
It really is as simple as that. Why anybody would suffer an inkjet in their house is beyond comprehension.
For photos use any one of the millions of photo printing services out there. You'll get better results, better paper, etc. Does anybody even print photos since we have smartphones?
If you work in graphic design and spend all day long printing photos then fair enough. Get an inkjet. The rest of the world should avoid them like the plague.
Is Arduino the exception that proves the rule?
But to answer your questions:
a) Yes. C++ has more information available for optimization.
eg. The compiler writer can optimize the compiler for std::vector rather than trying to optimize for every conceivable way a C programmer could mess around with pointers.
b) Yes. C++ makes it far easier to change data structures and optimize the code for different architectures than C does.
eg. Look at strcmp() vs wcscmp(). In C you need to choose a function name in advance. If you've got a bunch of legacy code to convert then how do you update it? With a macro? C++ has templates function overloading so it's much easier to adapt code to new data types.
Also new programming practices are much easier to implement.
eg. Updating code to to use strncpy() instead of strcpy(). It's going to be a lot of work to adapt a large C program to do that. If you're using a string class which defines operator=() for string copy then you change a few lines of code, job done.
Stroustrup's book is four times as long as K&R. Is K&R four times as long as a standard text on Assembly?
Yes.
Ok, I personally stopped coding in asm and switched to C because the processors got so complicated that a compiler would have a higher chance of creating faster code and so that porting the code between architectures would no longer require a complete rewrite of the whole program line by line. How would your C++ compiler be any better than a C compiler for any of that?
You're supposed to start by telling me that C is somehow better than C++, not that C is better than assembly language. :-)
So you use C++ because the compiler is better at optimizing for pipelines and cachelines than C compilers? Are you sure? Because that is why I don't code in asm anymore.
You're supposed to start with a "C vs. C++" comparison. I'm the one who converts it into a "C vs assembly language" comparison. :-)
SEGV is very unlikely if you're using C++ correctly, ie. std::containers, std::string and strong/weak smart pointers. Any bad access can be trapped just like in Java.
Exceptions in a destructor? Also very esoteric. Destructors are there to free resources not to make decisions.
But hey, I guess someone can prove my wrong by writing a better kernel in C++.
Somebody certainly could write a better kernel in C++, yes. There's absolutely no doubt about that.
Am I personally going to do it just to prove an AC wrong on Slashdot? No.
Grow up and get a proper argument.
With your specific example most C compilers will generate compile time warnings.
Visual C++ doesn't.
You can argue the toss over templates, etc. Yes they can be overused.
OTOH there's no valid excuse for not using std::containers, std::string and smart pointers.
None.
From what I've seen most github submitters are actually writing C using a C++ compiler, so... meh.
Is that written in the standard?
The point is that it won't overwrite memory. std::containers are range checked by default in many modern compilers.
Yep. The real difference between C and C++ isn't "classes", it's RAII. It's stack unwinding. It's exception handling.
LOL! I've been writing C since the 1980s, pre-ANSI. I've still got my original copy of K&R somewhere.
By modern standards it's a crap language, honestly. I've given up trying to educate C idiots though. They're beyond salvation.
Short version of the final argument:
a) You assert that C is best.
b) I say "Why aren't you writing in assembly language instead of C"?
c) Whatever you reply I simply reword it to replace "Assembler" with "C" and "C" with "C++" then give your own argument back to you.
ie. I use C++ instead of C for the exact same reasons you use C instead of assembly language.
By reduction: If you're not using assembly language then you should be using C++.
Yeah, the whole "compile-link" thing with separate headers is a bit 1970s.
It does work though and when I look at the sheer number of files/folders languages like Java produce then I'm not sure there's a much better replacement.
Um, yes. That's what the disk would be for.
The screen shows "BREAK AT LINE 1050".
We can assume that the program is more than ten lines long.
There's no need: C++ has modtly caught up to Ada and has far better IDEs and compilers. All you need to do is stop using the "C" part and you're golden.
C++ isn't C. If I open Visual C++ and type this code I'll get an exception when I try to run it:
std::vector a;
a[-1] = 0x666;
So next time you hear Linus Torvalds rant against C++ tell him to fuck off and stop being an idiot.
True, but the effort required to do it in (eg.) C is ridiculous. You can't really expect anybody to do it.
Other languages can do it a lot more easily, eg. C++. Range checking for things like std::vector is turned on by default in recent compilers.
ie. "array[-1] = 0x666;" will throw an exception, just like in Java.
You can go outside the box and start using raw pointers in C++ but it's not something you need to do, or should be doing very often.
And *this* is why Linus Torvalds is an idiot with all his anti-C++ rants and "we only use C here" mentality.
Yep. Too much 'critical' code is written by the boss's nephew just because he "seems to be good at computers".
Bjarne said it best:
The idea of programming as a semiskilled task, practiced by people with a few months' training, is dangerous. We wouldn't tolerate plumbers or accountants that poorly educated. We don't have as an aim that architecture (of buildings) and engineering (of bridges and trains) should become more accessible to people with progressively less training. Indeed, one serious problem is that currently, too many software developers are undereducated and undertrained. Obviously, we don't want our tools--including our programming languages--to be more complex than necessary. But one aim should be to make tools that will serve skilled professionals--not to lower the level of expressiveness to serve people who can hardly understand the problems, let alone express solutions. We can and do build tools that make simple tasks simple for more people, but let's not let most people loose on the infrastructure of our technical civilization or force the professionals to use only tools designed for amateurs.
- Bjarne
I noticed that as well but I figured it was just for the photo-shoot. The handle isn't clean enough for it to be raised/lowered very often and they have to be loading the BASIC from somewhere.
The 1541-II was (is) surprisingly rugged. It didn't have the overheat and head alignment issues that plagued the original 1541.
The disks themselves spin inside a cleaning cloth (the inside of a floppy sleeve). There's no fan to suck dirt in, so...plausible.
I'm more surprised that the monitor still works.
Asked on Reddit???
Jeez, they need a better "computer technician". Doesn't the NSA have somebody?
Can you explain how you are attacked by CF ip addresses? I'm a CF customer but can't see how CF could attack you.
Hackers must be spoofing their addresses so they look like they come from Cloudflare. People don't want to block Cloudflare so that makes them harder to filter.
Just buy lasers, people.
It really is as simple as that. Why anybody would suffer an inkjet in their house is beyond comprehension.
For photos use any one of the millions of photo printing services out there. You'll get better results, better paper, etc. Does anybody even print photos since we have smartphones?
If you work in graphic design and spend all day long printing photos then fair enough. Get an inkjet. The rest of the world should avoid them like the plague.
Yes. "More Sports" is the answer to everything.
Me too. The idea of traveling to a theme park and standing in line for an hours is just ludicrous.