Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Is C++ too complex?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
122 replies to this topic

#121 Yrjö P.   Crossbones+   -  Reputation: 1412

Like
0Likes
Like

Posted 13 December 2012 - 02:39 PM


[&](){ /* may return from inner loop here */ }();


I am not familiar enough with lambda expressions to know if this is cool or horrible. Posted Image

It's Cornstalks' function suggestion, just replacing the function with a lambda in order to fix the (potential) issues you pointed out. Those issues are exactly the kind lambdas are intended to deal with, and thus this piece of code is totally mundane, not any sort of trickery. I'd argue it is not horrible because it is straightforward and not a hack, and it is a little bit cool because it is straightforward and not a hack. Posted Image

Same natural code structure as with the goto solution, but no goto, no contrived names or messy argument lists.

The goto solution has the same natural code as with the lambda-expression solution, but no lambda expression and no returns that don't actually return from the function.

I'm not claiming it is massively better than the goto (if at all better), but it's obviously about as convenient, and also works for people who don't want to use goto or are prohibited from doing so.

The returns do return from the function. You are just thinking about the wrong function.Posted Image

Sponsor:

#122 Shannon Barber   Moderators   -  Reputation: 1383

Like
0Likes
Like

Posted 18 December 2012 - 09:05 PM

The problem with C++ is not the complexity.
There are many ways that C# and Java are more complex than C++ is.

The problem with C++ is that it is a mess.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

#123 Vortez   Crossbones+   -  Reputation: 2704

Like
0Likes
Like

Posted 20 December 2012 - 05:03 PM

I never understood this hated toward goto... it's not like using 1 or 2 goto in a program gona make the code unreadable or spagetified like it was back in the assembly days (when every branching was coded using gotos), from wich i believe that fear/hate come from. It's like not wanting to use a tool just because someone told you to :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS