4 ms·
Indeed. First off, it is unrealistic to expect to rewrite perl/python scripts (much higher level scripting languages) in C++ and expect the same level of succin
by reddit_clone 13y ago
Indeed. First off, it is unrealistic to expect to rewrite perl/python scripts (much higher level scripting languages) in C++ and expect the same level of succinctness.
C++ is for larger , high performance applications.
The piper needs to be paid one way or another. If you rewrite a perl script in C++ for performance, the relative increase in verbosity is the price you pay.
- btilly 13y agoI accept that a price has to be paid for performance. However I believe that a substantial amount of verbosity could be removed without impacting said performance. In fact C++11 removes some with type deduction. I also get tired of typing some_big_type foo = some_big_type(); - is there a way to say, "I want this thing, and I want it to get the obvious default initialization?" Because what I type now is straight from the redundant department of redundancy department. (Yes, a typedef can make that shorter. You still write the idea twice.)
- copper 13y agoWhile I agree with most of what you say, that one seems wrong: assuming it exists, the default constructor will work when you type > some_big_type foo;
- mpyne 13y agoTry auto foo = some_big_type(); If you're not talking about initialization, but instead talking about construction, just do some_big_type foo; (no parens needed).
- btilly 13y agoIf you're not talking about initialization... I thought I was very clear when I said: "I want this thing, and I want it to get the obvious default initialization?" I often wound up typing something like this: std::vector< my_big_type > list_foo = std::vector< my_big_type >(); It seemed useless the first time, and just got sillier as time went on.
- X-Istence 13y agosome_big_type foo; Now foo has been created. Want to pass parameters to its constructor: some_big_type foo(parameters, go, here); foo has been initialised. Need a pointer? auto *foo = new some_big_type foo(parameters, go, here);