Read The Daily WTF for while, you hardly ever see C++ on there (I'm not sure why, maybe it's because noobs don't try to use C or C++ any more...)
The problem isn't the language, it's the programmers. We require licenses to install wiring or pipework in people's houses but any fool can pick up a compiler and call him/herself a programmer.
That said, some implementations still do out-of-bounds and invalidation checks when compiled in "debug mode" - e.g. VC++ does that for all STL containers and also for iterators.
The latest versions of VC++ do it in release mode unless you explicitly tell them not to.
operator[] does not do a runtime check, and will result in code that potentially segfaults if you do an out of bounds array access (similar to doing the same thing with a C-style array.
It's not required to...but in theory it can... and in reality it *does*
(on Visual C++ at least you have to explicitly turn it off and I'm betting only a small percentage of people actually do because they don't even know it's doing it).
Just because it can be done, doesn't mean you should do it.
Most arguments against C++ are of the "Look, I can do this and it's bad!!!" type. Real C++ programmers just ignore them and carry on writing code which doesn't do that.
Yes. C/C++ are inherently predisposed towards being buggy and unsafe, relative to more modern languages. They trade runtime checks for minimal runtime overhead (and I'm not saying that's a bad thing), but they don't make any effort to assist the programmer in the area of code correctness.
Modern C++ implementations usually have run time checking on by default. eg. In Visual C++ std::vector checks the range of all indices to see if they're legal. If you do C++ right then the only memory error you'll is a null pointer (just like super safe Java).
C++ isn't problem-free, but all the old mid-1990's arguments aren't applicable any more, sorry.
PS: C and C++ are completely different languages, writing "C/C++" only shows your ignorance.
I find C++ quite obtuse too. C99 is pretty much the best compromise that I've found between gobbledegook and flexibility.
To an extent, OOP is just a formalisation of things that function programmers have been doing for decades into a space-saving syntax.
The big advantage of C++ over C is resource management (using "RIAA").
With C++ you can define a smart pointer type, use STL containers and strings and everything pretty much manages itself. With C you simply can't do that. Writing big/complex programs in C is an awful lot more work than in C++.
Exceptions too. If you're parsing a complex data file several layers deep then error handling will make C code enormously complex. With C++ you just throw an exception and let stack unwinding free all the temporary data for you.
Aren't the basic programming concepts understood and defined now? All a new language can really bring to the table is a different syntax.
The successful new 'languages' these days are those that include a big set of libraries, eg. Java and C#. People use them for the libraries more than the language. Without the libraries Java and C# are nothing more than reinventions of the UCSD p-system.
If your goal is "weight loss" then eating less is far easier and more effective than trying to burn it off at the gym. Going to the gym often makes you eat more when you get home - making it a waste of time.
(Yeah, I know it's heresy in the USA to say gym isn't the answer to everything...)
What exactly would he do? Latency is a function of all the hops between you and the other machine. I doubt they're going to reconfigure their network topology for a single user.
True, but you don't need to go that far. There's plenty of pairs of numbers which can be divided exactly in floating point. The claim that it's "never accurate" is laughable.
The amount of fuck in just this single slashdot thread offends my eyes. I browsed reddit couple of years ago daily, but it seems the glory days are over.
Unless GoodNewsJimDotCom is trolling, slashdot needs an enema.
Replying to this specific reply because I am impressed by the amount of idiocy one can contain in four words of less than four letters each.
Please explain how dividing 100 by 10 is inaccurate in floating point.
And it sounds like the sequence of instructions that causes it is not commonly found.
Really? Pop two off the stack and ret to the calling routine seems fairly common to me. Lots of functions use two arguments and are called with near calls in various programming languages.
So how come AMD systems aren't crashing all over the place? Why did it take him a year to be able to reproduce it reliably? I think my desktop machine has one of those chips in it but it's never had an unexplained crash.
I used to work for a guy who built servers out of whatever spare parts he had lying around - obsolete desktops, refurbs, ebay junk, whatever. For a while, we were spending at least 10-15 hours a week keeping those things up, or driving down to the datacenter to physically reboot them.
YMMV but I've got junker machines which have been running as servers 24/7 for years without a glitch. I'm just about to replace a few of them with Intel Atom boxes to save power/eardrums and I'm worrying about the reliability of the new machines. I'm going to keep the old machines lying around for at least a couple of months.
Multiplying and dividing are the least of your worries in floating point. Adding and subtracting are where the real problems happen.
eg.
float a = 0.1; float b = 0.2; if (a == b) {
print("Before the add, a is equal to b"); } float c = 10000000; a += c; b += c; if (a == b) {
print("After the add, a is equal to b"); }
What's the output? What happens if you multiply by c instead of adding it?
some chiropractors now extended their manipulation of the spine to children, and claimed that this could cure asthma, allergies, bedwetting, attention deficit hyperactivity disorder, colic, fever and numerous other problems, and could serve as a substitute for vaccination.
Some chiropractors have also broken people's necks. Do you really want them messing with your children's not-fully-formed spines?
I can make an image of the drive, then wipe the machine, and restore it back to its former state if I ever have to return it.
Can you shrink their partition, install another OS in the free space and dual boot? It would be a lot easier to do and you can switch between 'work' and 'play' modes.
If possible, make the original partition non-writable when you're in 'play' mode.
The same is true of any language.
Read The Daily WTF for while, you hardly ever see C++ on there (I'm not sure why, maybe it's because noobs don't try to use C or C++ any more...)
The problem isn't the language, it's the programmers. We require licenses to install wiring or pipework in people's houses but any fool can pick up a compiler and call him/herself a programmer.
That said, some implementations still do out-of-bounds and invalidation checks when compiled in "debug mode" - e.g. VC++ does that for all STL containers and also for iterators.
The latest versions of VC++ do it in release mode unless you explicitly tell them not to.
The statement about std::vector is... mostly wrong.
http://www.cplusplus.com/reference/stl/vector/operator%5B%5D/
operator[] does not do a runtime check, and will result in code that potentially segfaults if you do an out of bounds array access (similar to doing the same thing with a C-style array.
It's not required to...but in theory it can ... and in reality it *does*
(on Visual C++ at least you have to explicitly turn it off and I'm betting only a small percentage of people actually do because they don't even know it's doing it).
Stop obsessing over syntax.
The point is: When you write C++ you think in an entirely different way then when you write C. You approach problems from an entirely different angle.
(Or at least, you should...)
Just because it can be done, doesn't mean you should do it.
Most arguments against C++ are of the "Look, I can do this and it's bad!!!" type. Real C++ programmers just ignore them and carry on writing code which doesn't do that.
Yes. C/C++ are inherently predisposed towards being buggy and unsafe, relative to more modern languages. They trade runtime checks for minimal runtime overhead (and I'm not saying that's a bad thing), but they don't make any effort to assist the programmer in the area of code correctness.
Modern C++ implementations usually have run time checking on by default. eg. In Visual C++ std::vector checks the range of all indices to see if they're legal. If you do C++ right then the only memory error you'll is a null pointer (just like super safe Java).
C++ isn't problem-free, but all the old mid-1990's arguments aren't applicable any more, sorry.
PS: C and C++ are completely different languages, writing "C/C++" only shows your ignorance.
C++ compilers can do a lot more than check types. They automate an awful lot of programming work for you, eg. via stack unwinding.
I find C++ quite obtuse too. C99 is pretty much the best compromise that I've found between gobbledegook and flexibility.
To an extent, OOP is just a formalisation of things that function programmers have been doing for decades into a space-saving syntax.
The big advantage of C++ over C is resource management (using "RIAA").
With C++ you can define a smart pointer type, use STL containers and strings and everything pretty much manages itself. With C you simply can't do that. Writing big/complex programs in C is an awful lot more work than in C++.
Exceptions too. If you're parsing a complex data file several layers deep then error handling will make C code enormously complex. With C++ you just throw an exception and let stack unwinding free all the temporary data for you.
Aren't the basic programming concepts understood and defined now? All a new language can really bring to the table is a different syntax.
The successful new 'languages' these days are those that include a big set of libraries, eg. Java and C#. People use them for the libraries more than the language. Without the libraries Java and C# are nothing more than reinventions of the UCSD p-system.
Laserdisc was Analog - basically basically VHS stored on a shiny platter.
You may not care whether or not it's illegal to rip your own DVDs, but if people are using this service...
Are they using it...?
If your goal is "weight loss" then eating less is far easier and more effective than trying to burn it off at the gym. Going to the gym often makes you eat more when you get home - making it a waste of time.
(Yeah, I know it's heresy in the USA to say gym isn't the answer to everything...)
PS: Talking of hops, tracert will show you how many hops are between you and their "test servers". Finding that out would be a good starting point.
What exactly would he do? Latency is a function of all the hops between you and the other machine. I doubt they're going to reconfigure their network topology for a single user.
True, but you don't need to go that far. There's plenty of pairs of numbers which can be divided exactly in floating point. The claim that it's "never accurate" is laughable.
/facepalm
The amount of fuck in just this single slashdot thread offends my eyes. I browsed reddit couple of years ago daily, but it seems the glory days are over.
Unless GoodNewsJimDotCom is trolling, slashdot needs an enema.
Replying to this specific reply because I am impressed by the amount of idiocy one can contain in four words of less than four letters each.
Please explain how dividing 100 by 10 is inaccurate in floating point.
You can't hear sounds if you haven't heard them before? Seriously? Do you really believe that?
It's true! Some sounds have to be 'learned' - for exactly the same reasons that a duck's quack doesn't echo.
And it sounds like the sequence of instructions that causes it is not commonly found.
Really?
Pop two off the stack and ret to the calling routine seems fairly common to me. Lots of functions use two arguments and are called with near calls in various programming languages.
So how come AMD systems aren't crashing all over the place? Why did it take him a year to be able to reproduce it reliably? I think my desktop machine has one of those chips in it but it's never had an unexplained crash.
I used to work for a guy who built servers out of whatever spare parts he had lying around - obsolete desktops, refurbs, ebay junk, whatever. For a while, we were spending at least 10-15 hours a week keeping those things up, or driving down to the datacenter to physically reboot them.
YMMV but I've got junker machines which have been running as servers 24/7 for years without a glitch. I'm just about to replace a few of them with Intel Atom boxes to save power/eardrums and I'm worrying about the reliability of the new machines. I'm going to keep the old machines lying around for at least a couple of months.
Just so you know, division is never accurate in floats
Um, yes it is.
Multiplying and dividing are the least of your worries in floating point. Adding and subtracting are where the real problems happen.
eg.
float a = 0.1;
float b = 0.2;
if (a == b) {
print("Before the add, a is equal to b");
}
float c = 10000000;
a += c;
b += c;
if (a == b) {
print("After the add, a is equal to b");
}
What's the output?
What happens if you multiply by c instead of adding it?
with a 32 bit floating point number, you shouldn't be surprised to find errors in the third digit after the decimal point.
So working with millimeters is completely impossible then?
Bummer. There goes my plan to write a CAD system using metric measurements.
some chiropractors now extended their manipulation of the spine to children, and claimed that this could cure asthma, allergies, bedwetting, attention deficit hyperactivity disorder, colic, fever and numerous other problems, and could serve as a substitute for vaccination.
Some chiropractors have also broken people's necks. Do you really want them messing with your children's not-fully-formed spines?
How does something like homeopathy even find it's way into a traditional school?
How do you even "study" homeopathy? The text book can't be more than a single sheet of paper....
I dunno.... to me they seemed a LOT easier to read then a lot of recent image captchas (which are becoming impossible for humans).
If security is equal then that makes them worthwhile.
I can make an image of the drive, then wipe the machine, and restore it back to its former state if I ever have to return it.
Can you shrink their partition, install another OS in the free space and dual boot? It would be a lot easier to do and you can switch between 'work' and 'play' modes.
If possible, make the original partition non-writable when you're in 'play' mode.
This is almost the same as having two laptops.