• Create Account

## 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.

122 replies to this topic

### #121Yrjö P.  Members

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.

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.

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.

### #122Shannon Barber  Moderators

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

### #123Vortez  Members

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.