In linus' view, it does not matter if something requires more effort or oversight in regards to code so long as architecturally it is better
Of course C can be made perfect... but so can assembly language so why not use that? (Ignoring portability for a moment...)
I hope you'll agree that writing (eg.) Linux in assembly language would need an order of magnitude more effort than writing it in C. I see the C vs. C++ argument in exactly the same way.
Linus is *wrong*, there's no downside to using C++ instead of C. If a bad program results from using C++ then it's the fault of the programmer, not the language.
Passing objects by value would be bad, yes, but passing around a reference to an object is just as efficient as passing a raw pointer (simple logic: references are really just pointers in disguise).
You can use a raw pointer in the middle of tight loop if you want, I'm fine with that, often do it myself in fact, but keep raw pointers *local*, ie. they die at the end of the function. Don't pass raw pointers around and don't store them long-term.
PS: I'm the sort of person who regularly looks at the assembly output of my compiler, just to be sure...
OK, you had me until there. If you are using multiple inheritance you have a flaw at the architectural level.
That's just a knee-jerk reaction.
You could make a coding rule that forbids multiple inheritance of classes other than base classes, I'll accept that, but multiple inheritance is needed.
nb. Java tries to enforce that rule by only allowing "one base class plus interfaces". That's OK as far as it goes but it forces you to copy/paste the default implementations of interface classes all over the place which is stupid (and can lead to some major editing sessions if the design ever changes). Much better to let the programmer decide for himself - he's the one with knowledge of the job at hand, not the compiler.
I'm aware of the Linux kernel, I also think it could be a lot better/safer if a bit of C++ was allowed into it. The only reason it's 100% C is because Linus doesn't really grok C++ (he's demonstrated this quite clearly in his anti-C++ rants).
The reason I say C is unsafe is because there's no way to enforce safety in C. It's all down to the programmer to get it 100% perfect, every time.
eg. If you're using a smart pointer in C++ there's no way you can forget to initialize it to null, the compiler does it for you (and the compiler never has a bad day and forgets to do it...)
The end result is quite powerful, but not something I'd ever dare to call "safe".
C++ is as safe as you want to make it.
eg. Did you know that Visual C++ operator[] does range checking in all standard container classes/strings?
If you do stuff like that and ban raw pointers (ie. all pointers have to be objects and thus subject to RIAA) then most of your traditional C++ problems disappear. It just takes a bit of practice and getting over the C mentality.
In return you get multiple inheritance, timely freeing of resources, operator overloading and much more expressive power than Java.
A good portion of Java code is just copy/paste because you can't inherit implementation and try/finally blocks to get your files closed at the end of functions, not just when the garbage collector feels like it (which might be 'never'). In C++ you write code once in a library and it stays written.
A major cost of nuclear reactors is the bickering of the NIMBYs. Construction can take fifteen years (ten for bickering, five for construction). An investor could be investing in something else which makes money during that time so to convince him to invest in your plant you have to garantee massive returns in the future.
Seriously though, this delay could be a good thing. They were going to build the wrong sort of reactors and perpetuate all the problems of the 1950s atom bomb production plants.
Thorium reactors, pebble beds..? Not on the shortlist. I'm guessing Westinghouse has plenty of lobbyists.
From the summary it sounds like he learned C, not C++. There's a huge, grand-canyon-sized difference between the two.
C++ is a safe, expressive, modern language - like Java but without all the horrible limitations. Yes it takes a bit of study and it's not for casual programmers, but the results are worth it.
C is much lower level, unsafe language. Good for what it does but dangerous and a very bad choice for large projects.
We're talking about internet voting, not voting machines. ie. People voting from their botnet-ridden home PCs.
What's to stop a party from releasing a virus which triggers once on election day then deletes itself from disk? Such a virus could subvert the entire process, regardless of public keys, SSL, whatever.
Nintendo/SEGA prices were much higher because Nintendo/SEGA took a big cut of the profits for the privilege of writing games for their console.
On top of that, only they could manufacture the cartridges and they charged a lot for that as well.
Plus... development was very risky because they only accepted a fixed quota of games per year to keep the market from saturating. If they didn't like yours it wouldn't get published (and you only got *one* shot at acceptance... you showed them the game and if they didn't like it you were dismissed, no second chance)
So yeah, comparing the price of NES games to Speccy games is pointless. Development costs for Japanese consoles were orders of magnitude more than for Speccy/C64.
In linus' view, it does not matter if something requires more effort or oversight in regards to code so long as architecturally it is better
Of course C can be made perfect ... but so can assembly language so why not use that? (Ignoring portability for a moment...)
I hope you'll agree that writing (eg.) Linux in assembly language would need an order of magnitude more effort than writing it in C. I see the C vs. C++ argument in exactly the same way.
Linus is *wrong*, there's no downside to using C++ instead of C. If a bad program results from using C++ then it's the fault of the programmer, not the language.
e.g. humans just aren't good at always getting tedious details right.
This is where C++ really towers above C - all those tedious details can be handed to the compiler and the compiler never forgets them.
Passing objects by value would be bad, yes, but passing around a reference to an object is just as efficient as passing a raw pointer (simple logic: references are really just pointers in disguise).
You can use a raw pointer in the middle of tight loop if you want, I'm fine with that, often do it myself in fact, but keep raw pointers *local*, ie. they die at the end of the function. Don't pass raw pointers around and don't store them long-term.
PS: I'm the sort of person who regularly looks at the assembly output of my compiler, just to be sure...
OK, you had me until there. If you are using multiple inheritance you have a flaw at the architectural level.
That's just a knee-jerk reaction.
You could make a coding rule that forbids multiple inheritance of classes other than base classes, I'll accept that, but multiple inheritance is needed.
nb. Java tries to enforce that rule by only allowing "one base class plus interfaces". That's OK as far as it goes but it forces you to copy/paste the default implementations of interface classes all over the place which is stupid (and can lead to some major editing sessions if the design ever changes). Much better to let the programmer decide for himself - he's the one with knowledge of the job at hand, not the compiler.
I'm aware of the Linux kernel, I also think it could be a lot better/safer if a bit of C++ was allowed into it. The only reason it's 100% C is because Linus doesn't really grok C++ (he's demonstrated this quite clearly in his anti-C++ rants).
The reason I say C is unsafe is because there's no way to enforce safety in C. It's all down to the programmer to get it 100% perfect, every time.
eg. If you're using a smart pointer in C++ there's no way you can forget to initialize it to null, the compiler does it for you (and the compiler never has a bad day and forgets to do it...)
Did I really type RIAA instead of RAII? Oh, dear...
The end result is quite powerful, but not something I'd ever dare to call "safe".
C++ is as safe as you want to make it.
eg. Did you know that Visual C++ operator[] does range checking in all standard container classes/strings?
If you do stuff like that and ban raw pointers (ie. all pointers have to be objects and thus subject to RIAA) then most of your traditional C++ problems disappear. It just takes a bit of practice and getting over the C mentality.
In return you get multiple inheritance, timely freeing of resources, operator overloading and much more expressive power than Java.
A good portion of Java code is just copy/paste because you can't inherit implementation and try/finally blocks to get your files closed at the end of functions, not just when the garbage collector feels like it (which might be 'never'). In C++ you write code once in a library and it stays written.
everything that was "unsafe" about good old C is still there.
So, um, don't use those bits...use std::vector and std::string instead.
This is where 'learning' C++ comes into play, as opposed to just hacking around and copying/pasting C source code until it works.
If you're doing it right the only problems you should have in C++ are null pointer exceptions - just like Java.
Any real safety still needs to come from the experience of the programmer
That, and having a teacher who smacked you down every time you tried to use a C-style array or didn't do RIAA.
A major cost of nuclear reactors is the bickering of the NIMBYs. Construction can take fifteen years (ten for bickering, five for construction). An investor could be investing in something else which makes money during that time so to convince him to invest in your plant you have to garantee massive returns in the future.
Wikipedia has a page on the economics: http://en.wikipedia.org/wiki/Economics_of_new_nuclear_power_plants
Seriously though, this delay could be a good thing. They were going to build the wrong sort of reactors and perpetuate all the problems of the 1950s atom bomb production plants.
Thorium reactors, pebble beds..? Not on the shortlist. I'm guessing Westinghouse has plenty of lobbyists.
It's a long-term loan. The interest rate of a bank over long terms is crippling. Governments can do special low-interest rates if they want to.
You haven't solved those problems yet?? I thought they would have been solved 20 years ago.
I'm flying next week and suddenly I'm nervous.
C++ doesn't teach you anything, you study it.
From the summary it sounds like he learned C, not C++. There's a huge, grand-canyon-sized difference between the two.
C++ is a safe, expressive, modern language - like Java but without all the horrible limitations. Yes it takes a bit of study and it's not for casual programmers, but the results are worth it.
C is much lower level, unsafe language. Good for what it does but dangerous and a very bad choice for large projects.
Seriously? Security wasn't a key part of Linux/Unix?
It's the only place in California where the iPhone can get a decent signal...?
the voter's registration card has a public encryption key...yada yada
...and their swiss-cheese-security PC has a specially released vote changing virus on it.
Oh, dear. All your maths and cryptographic theory was just defeated by a $5 wrench.
We're talking about internet voting, not voting machines. ie. People voting from their botnet-ridden home PCs.
What's to stop a party from releasing a virus which triggers once on election day then deletes itself from disk? Such a virus could subvert the entire process, regardless of public keys, SSL, whatever.
What about all those "botnets" you see in the news?
Strength of cryptographic algorithms, etc., is completely irrelevant when people vote by visiting a web page using their home PC.
You know all those machines which are affected by things called "botnets" you see in the news...?
Basically there's millions and millions of people who aren't really in control of their home computers.
Strength of cryptographic algorithms would be irrelevant if the balance of power was decided by people visiting a web page using those computers.
Boy, are you out of touch.... your chidren can buy pot any time they choose. Today.
If you're been told your entire life that pot turns people into total stoners and losers then seeing some normal people smoking pot could dispel that.
OTOH, correlation isn't causation. Smoking pot definitely won't make you any smarter.
One quick phone call and your web site is back up again. I bet if it was joe sixpack it'd still be down.
So ... what software will replace Photoshop on Mac?
Nintendo/SEGA prices were much higher because Nintendo/SEGA took a big cut of the profits for the privilege of writing games for their console.
On top of that, only they could manufacture the cartridges and they charged a lot for that as well.
Plus ... development was very risky because they only accepted a fixed quota of games per year to keep the market from saturating. If they didn't like yours it wouldn't get published (and you only got *one* shot at acceptance ... you showed them the game and if they didn't like it you were dismissed, no second chance)
So yeah, comparing the price of NES games to Speccy games is pointless. Development costs for Japanese consoles were orders of magnitude more than for Speccy/C64.
I think he's talking about the Neo Geo - a programmable arcade machine for the home (with prices to match).