|
|
| Author |
Message |
| Lord Percy |
This post is not being displayed .
|
 Lord Percy World Chat Champion

Joined: 03 Aug 2012 Karma :  
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| SQL |
This post is not being displayed .
|
 SQL World Chat Champion

Joined: 09 Aug 2012 Karma :   
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Lord Percy |
This post is not being displayed .
|
 Lord Percy World Chat Champion

Joined: 03 Aug 2012 Karma :  
|
 Posted: 00:09 - 12 Feb 2014 Post subject: |
 |
|
I thought I'd get better coverage in this section
Anyway it looks like I've done it, and I think I actually had already done it all along.
The real problem was some shitty underlying computer issue. While messing around with the code, I'd told it to draw info from an unused bit of memory which caused it to basically have a stroke and not tell me about it. No matter what I did after that, even the most basic bit of coding would crash. After restarting the computer, everything works again, woohoo!
 |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Rogerborg |
This post is not being displayed .
|
 Rogerborg nimbA

Joined: 26 Oct 2010 Karma :    
|
 Posted: 14:12 - 12 Feb 2014 Post subject: |
 |
|
5 6 fixes.
| Code: |
#include <string>
#include <iostream> // #1 Need iostream for cout
int main()
{
std::string * strPtr = new std::string("hello"); // #2 Mismatched '", #3 needs another std::
std::cout << *strPtr << std::endl; // #4 We want the object that strPtr points to, not the address of it
delete strPtr; // #5 Not an array, don't use array delete[]
//std::cout << *strPtr << std::endl; // #6 Don't use the object again after deleting it
}
|
____________________ Biking is 1/20th as dangerous as horse riding.
GONE: HN125-8, LF-250B, GPz 305, GPZ 500S, Burgman 400 // RIDING: F650GS (800 twin), Royal Enfield Bullet Electra 500 AVL, Ninja 250R because racebike |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Stowelly |
This post is not being displayed .
|
 Stowelly Traffic Copper
Joined: 25 Oct 2009 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Lord Percy |
This post is not being displayed .
|
 Lord Percy World Chat Champion

Joined: 03 Aug 2012 Karma :  
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| barrkel |
This post is not being displayed .
|
 barrkel World Chat Champion
Joined: 30 Jul 2012 Karma :   
|
 Posted: 21:07 - 12 Feb 2014 Post subject: |
 |
|
| Stowelly wrote: | | Code: |
return 0; //#7 int return type is expected 0 is success
|
|
Technically, main returns 0 if there is no explicit return.
ISO/IEC 14882:2003 § 3.6.1 paragraph 5:
| Quote: | A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage duration) and calling exit with the return value as the argument. If control reaches the end of main without encountering a return statement, the effect is that of executing
|
____________________ Bikes: S1000R, SH350; Exes: Vity 125, PS125, YBR125, ER6f, VFR800, Brutale 920, CB600F, SH300x4
Best road ever ridden: www.youtube.com/watch?v=s2MhNxUEYtQ |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Stowelly |
This post is not being displayed .
|
 Stowelly Traffic Copper
Joined: 25 Oct 2009 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| gfrancisdev |
This post is not being displayed .
|
 gfrancisdev Nova Slayer

Joined: 18 Oct 2012 Karma :    
|
 Posted: 21:57 - 12 Feb 2014 Post subject: |
 |
|
Well if you're being pedantic
| Code: | | int main(int argc, char** argv); |
____________________ ybr125(07 silver)-killed 2013/4/3 on some ice
ybr125(06 blue), KE100(89 green-black-puke) |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Stowelly |
This post is not being displayed .
|
 Stowelly Traffic Copper
Joined: 25 Oct 2009 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Clanger |
This post is not being displayed .
|
 Clanger Stirrer

Joined: 27 May 2004 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Rogerborg |
This post is not being displayed .
|
 Rogerborg nimbA

Joined: 26 Oct 2010 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| el_oso |
This post is not being displayed .
|
 el_oso World Chat Champion

Joined: 17 May 2008 Karma :  
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| J.M. |
This post is not being displayed .
|
 J.M. World Chat Champion

Joined: 27 Mar 2011 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Stowelly |
This post is not being displayed .
|
 Stowelly Traffic Copper
Joined: 25 Oct 2009 Karma :    
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Dalemac |
This post is not being displayed .
|
 Dalemac World Chat Champion

Joined: 15 Oct 2006 Karma :  
|
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| barrkel |
This post is not being displayed .
|
 barrkel World Chat Champion
Joined: 30 Jul 2012 Karma :   
|
 Posted: 03:27 - 16 Feb 2014 Post subject: |
 |
|
| Stowelly wrote: | been programming c++ for 12 years, and still learn new things about the language every day!. |
I first learned C++ in about 96, then started reading Herb Sutter's GotW, and realized that C++ was like a fractal; the more you studied it, the more flaws came out of the woodwork, and the more you had to know to write bulletproof code. The hilarious interactions that lead to e.g. std::stack<T>::pop() not being able to return the item popped, function try blocks (hahahaha!), Turing-complete templates (infinite wankery for the dedicated nerd), right up to C++11 switchable lambdas (capture by reference or value? either, you choose!). The sheer amount of knowledge you need to write exception-safe code - even with RAII to hand - is ridiculous.
Stroustrup never met a language feature he didn't covet. That leaves it up to individual people, teams, companies to choose the acceptable bits. And there are a bunch of subsets that interact sanely. Trouble is, everybody has different subsets, and library interaction suffers because the libraries aren't always lowest common denominator (at which point, they might as well be C). C++ has never had the kind of rich third-party library ecosystem its popularity would seem to merit.
You're right that it still has its niche. But Go and Rust are starting to creep into mindshare at the elite level. Personally, I hope C++ dies in a fire. ____________________ Bikes: S1000R, SH350; Exes: Vity 125, PS125, YBR125, ER6f, VFR800, Brutale 920, CB600F, SH300x4
Best road ever ridden: www.youtube.com/watch?v=s2MhNxUEYtQ |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| Stowelly |
This post is not being displayed .
|
 Stowelly Traffic Copper
Joined: 25 Oct 2009 Karma :    
|
 Posted: 10:46 - 16 Feb 2014 Post subject: |
 |
|
| barrkel wrote: | | Stowelly wrote: | been programming c++ for 12 years, and still learn new things about the language every day!. |
I first learned C++ in about 96, then started reading Herb Sutter's GotW, and realized that C++ was like a fractal; the more you studied it, the more flaws came out of the woodwork, and the more you had to know to write bulletproof code. The hilarious interactions that lead to e.g. std::stack<T>::pop() not being able to return the item popped, function try blocks (hahahaha!), Turing-complete templates (infinite wankery for the dedicated nerd), right up to C++11 switchable lambdas (capture by reference or value? either, you choose!). The sheer amount of knowledge you need to write exception-safe code - even with RAII to hand - is ridiculous.
Stroustrup never met a language feature he didn't covet. That leaves it up to individual people, teams, companies to choose the acceptable bits. And there are a bunch of subsets that interact sanely. Trouble is, everybody has different subsets, and library interaction suffers because the libraries aren't always lowest common denominator (at which point, they might as well be C). C++ has never had the kind of rich third-party library ecosystem its popularity would seem to merit.
You're right that it still has its niche. But Go and Rust are starting to creep into mindshare at the elite level. Personally, I hope C++ dies in a fire. |
those GOTW articles are quite interesting, is a hell of a lot of gotchas with the language! wouldnt quite agree with hoping it dies in a fire. it definitely has its uses (if only to keep people employed!!). but at the same time ive been doing a lot of erlang programming the last couple of years and finding it does a lot of things just so much better. but i guess its a completely different paradigm solving different problems |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
| barrkel |
This post is not being displayed .
|
 barrkel World Chat Champion
Joined: 30 Jul 2012 Karma :   
|
 Posted: 16:40 - 16 Feb 2014 Post subject: |
 |
|
| Stowelly wrote: | wouldnt quite agree with hoping it dies in a fire. it definitely has its uses |
It has its uses because there are no hardened, popular alternatives with wide platform support. When there are - and there will be within the next 10 years, now that LLVM has democratized access to an optimizing back end - it should take only another 10 or 20 years for C++ to die.
So I'd put a bet on C++ being in the minority for its current niche in 30 years time. I wish it could happen sooner, but it's unlikely. ____________________ Bikes: S1000R, SH350; Exes: Vity 125, PS125, YBR125, ER6f, VFR800, Brutale 920, CB600F, SH300x4
Best road ever ridden: www.youtube.com/watch?v=s2MhNxUEYtQ |
|
| Back to top |
|
You must be logged in to rate posts |
|
 |
Old Thread Alert!
The last post was made 12 years, 228 days ago. Instead of replying here, would creating a new thread be more useful? |
 |
|
|