Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 3 [4]
  ignore  |  Print  
  The hidden cost of C++  (Read 9551 times)
0 Members and 1 Guest are viewing this topic.
Offline KittenKoder

Senior Member


Medals: 7
Projects: 1



« Reply #90 - Posted 2012-11-01 11:10:17 »

In C++, this is not valid:
1  
vector<vector<vector<double>>> myVec;


This is valid  Huh:
1  
vector<vector<vector<double> > > myVec;

I think that doesn't make sense at all.  Undecided

The ambiguity of the >> and >>> is a fault of the overriding of operators, this is both a strength and a weakness. Java avoids this by not allowing operator overriding, one of the many aspects of Java I like. Overriding operators does make more compact source code, but in reality it doesn't make things more readable and just offers certain flaws such as the above nuance.

I am no one else.
Offline Roquen

JGO Ninja


Medals: 66



« Reply #91 - Posted 2012-11-01 15:08:58 »

Operator overloading isn't the problem.  An ambiguous syntax is. 
Offline sproingie
« Reply #92 - Posted 2012-11-01 17:57:06 »

That's actually one of the reasons I do and don't like c/c++, pointers are "open access." You can type cast anything to anything, but you have to remember what you've cast something as or you'll access part of something else ... maybe even part of another program.

C++ is actually fairly strict about that sort of thing with normal casts (C-style or static_cast<>), much more so than C is.  Now there is reinterpret_cast<> which really is an anything-to-anything cast, but it's got a clunky distinctive name like that for a reason.

What does kill me about C is stuff like slicing, which you can only seem to avoid by using pointers.  That and implicit copy constructors -- at least Scala's implicit conversions require an 'implicit' keyword, C++ forces you to opt out with 'explicit'.

Games published by our own members! Check 'em out!
Try the Free Demo of Revenge of the Titans
Offline sproingie
« Reply #93 - Posted 2012-11-01 17:59:45 »

In C++, this is not valid:
1  
vector<vector<vector<double>>> myVec;


This is valid  Huh:
1  
vector<vector<vector<double> > > myVec;

I think that doesn't make sense at all.  Undecided

It doesn't have to, because it's not the case anymore.  GCC fixed it a long time ago, and it's part of the C++ standard.  It's also got jack shit to do with operator overloading, it's ambiguity at the lex/parse level.  Incidentally, the ambiguity is with >>, C++ does not have a >>> operator. 
Offline Oskuro

JGO Coder


Medals: 16


Coding in Style


« Reply #94 - Posted 2012-11-02 12:19:58 »

In C++, this is not valid:
1  
vector<vector<vector<double>>> myVec;


This is valid  Huh:
1  
vector<vector<vector<double> > > myVec;

I think that doesn't make sense at all.  Undecided

Now, it is certainly inconvenient when a parser/compiler does this kind of thing, but it isn't hard to understand why.

If you have trouble understanding the reason why these inconveniences happen, then maybe you are the problem?

Not trying to be smug or anything. In my experience with different languages, a big part of the development process is finding ways to work around limitations (usually cursing all the way through).

Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #95 - Posted 2012-11-02 13:27:14 »

Recognising ones own limitations as well as others is a very positive attitude to have in life, though. I recognised years ago that C++ was basically too difficult for me to get anything done in, in any reasonable length of time. So I picked something much simpler to work with.

Cas Smiley

Offline Oskuro

JGO Coder


Medals: 16


Coding in Style


« Reply #96 - Posted 2012-11-03 16:37:00 »

Indeed.

I personally have an irrational love for C++, but still prefer to start development in Java until I have a good idea of what I'm doing, before even attempting to get knee-deep in segmentation faults.

Online Jimmt
« Reply #97 - Posted 2012-11-03 17:18:17 »

It's good to be lazy sometimes  Wink
Pages: 1 2 3 [4]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (88 views)
2013-05-17 21:29:12

alaslipknot (96 views)
2013-05-16 21:24:48

gouessej (128 views)
2013-05-16 00:53:38

gouessej (123 views)
2013-05-16 00:17:58

theagentd (130 views)
2013-05-15 15:01:13

theagentd (118 views)
2013-05-15 15:00:54

StreetDoggy (161 views)
2013-05-14 15:56:26

kutucuk (184 views)
2013-05-12 17:10:36

kutucuk (185 views)
2013-05-12 15:36:09

UnluckyDevil (191 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.108 seconds with 21 queries.