BinaryByter
its just that you make another vector owner of the data pointer
BinaryByter
btw: its UB to use an object after it was moved
Nomid Íkorni-Sciurus
Hm... it still sounds weird. When is this behaviour preferred over actually putting the pointer as an argument?
Nomid Íkorni-Sciurus
isn't it easier to pass the reference to a method as a parameter instead of moving the pointer?
BinaryByter
BinaryByter
(well you do, but you shouldn't access it)
Nomid Íkorni-Sciurus
BinaryByter
BinaryByter
you can't return a reference to a local object
BinaryByter
(that use is obsolete though, since we have standardized RVO)
BinaryByter
but what about temporaries?
BinaryByter
std::cout « std::move (string("hello world"));
Nomid Íkorni-Sciurus
isn't having the std::vector in a class and then passing it as vector& in a method more convenient?
Nomid Íkorni-Sciurus
that way I'm referencing the whole vector structure and not its internal stuff
BinaryByter
BinaryByter
but you can't return a reference to a local
Nomid Íkorni-Sciurus
does that apply to class fields as well?
BinaryByter
how would you return a reference to a local?
Nomid Íkorni-Sciurus
(maybe I'm thinking too much OOP / Java)
BinaryByter
the local will be destroyed once out of scope
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
Now I see the point of introducing that feature.
Nomid Íkorni-Sciurus
I think I'm too used to Java.
BinaryByter
though now with RVO its kinda obsolete in those cases
BinaryByter
you should prefer RVO over move since move has overhead
BinaryByter
BinaryByter
hereth
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
I'm not biased. Though, I get easily influenced.
Nomid Íkorni-Sciurus
When I begun C++ for fun there were a lot of people angry about their experiences, for example I have read some topics about the new features being bad in performance or useless, though never got deeper because I was already scared about the general complexity of the language (and still am)
BinaryByter
the comitee has fucked up some features
BinaryByter
(atomics can be solved by mutexes? are they insane????)
Nomid Íkorni-Sciurus
for example, another weird thing is how lambdas are written and the fact that it has LOTS of concepts to learn
BinaryByter
lambdas have lots of concepts to learn?
Nomid Íkorni-Sciurus
lambdas have lots of concepts to learn?
I'm not English, sorry for bad speech.
I meant that lambdas have a weird syntax and that C++ has a lot of concepts, the more you dig into the documentaion (I wonder if you really need to use all of that stuff)
Nomid Íkorni-Sciurus
I forget that English requires the subject of the phrase to be always specified in the context unless it's a poem.
BinaryByter
BinaryByter
because they make your code safer and cleaner
Nomid Íkorni-Sciurus
in the case of C++ I expect it to require quite a lot of time to learn all of them.
BinaryByter
learn by doing ¯\_(ツ)_/¯
🐰🐾 سمیه
Nomid Íkorni-Sciurus
with one only exception
Nomid Íkorni-Sciurus
which is C.
BinaryByter
BinaryByter
python is a beast under the hood
Ибраги́м
👌
I like u, u do like dark adventures.
Ибраги́м
which is C.
Which has stupidity littered all over the place
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
C is a simple language
Nomid Íkorni-Sciurus
it might not be modern but there are lots of libraries.
Ибраги́м
Complexity is like fat, u can cut it out.
Treating stupidity takes a toll
Ибраги́м
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
Same can be said for C++
though, C++ constantly adds new language built-ins, which I think it's different
Ибраги́м
Ибраги́м
D is 1000x simpler than C.
Ибраги́м
And much more modern
Ибраги́м
Ибраги́м
Slow to update
Nomid Íkorni-Sciurus
Keep shifting the goalposts eh
The thing is that I'm looking for a language I can learn for fun and that might be useful for work.
To this time, the one that fit has been Java because it's been simpler for me to learn
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
I know that there are a lot of languages out there ready to be discovered
Nomid Íkorni-Sciurus
but it would be better if it had more support in case I needed a connector for, say, Apache Lucene for that
Nomid Íkorni-Sciurus
Take D for example
Nomid Íkorni-Sciurus
it's great and I didn't use all of it, but the IDE support for it is little or bugged
Nomid Íkorni-Sciurus
I remember in particular that its Visual Studio plugin had an issue with spaces in paths and it kept warning me that it could not read the files
Nomid Íkorni-Sciurus
say that I wanted a GraphQL implementation in D
Nomid Íkorni-Sciurus
There's none on the web, at least searching on Google
Nomid Íkorni-Sciurus
@OxFFFFFFFF I'm being pretty picky I guess 😅
Dima
1. Exception handling is the only C++ language feature which requires significant support from a complex runtime system, and it's the only C++ feature that has a runtime cost even if you don't use it.
- Patently false. And soon there will be: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0709r0.pdf
Major compilers' exceptions are not gonna hit u unless u throw them, true for GCC @ least
2.
#include <stdio.h>
int main()
{
printf("hello, world\n");
return 0;
}
Using fmtlib, we've got our own formatting
fmt::print("Hello, world"); with better type checking and outstanding perf.
3. Don't use RTTI.
Perhaps one embedded dev or RTOS dev missed road. TBF, I haven't personally used this, but like every other "dreaded" feature some people/industry will find a use for it. I don't know why Locale isn't on your list tho.
4. Don't use C++ runtime wrapper for C runtime includes (<cstdio>, <cmath>, etc.), use C runtime instead (<stdio.h>, <math.h>, etc.)
Even when they come with constexpr included?
5. Don't use stream (<iostream>, <stringstream>, etc.), use printf style functions instead.
Ofcourse, that's why we have fmtlib
6. Don't use anything from STL that allocates memory, unless you don't care about memory management.
And that's why programmers are still writing:
for (int i = 0; i < strlen(s); ++i) { ... } till tomorrow
7. Don't use metaprogramming excessively for academic masturbation. Use it in moderation, only where necessary, and where it reduces code complexity.
This will age quickly as C++ get better facilities like Concepts. These guys never read proposals before masturbating GitHub themselves.
8. Wary of any features introduced in current standard C++, ideally wait for improvements of those feature in next iteration of standard. Example constexpr from C++11 became usable in C++14 (per Jason Turner cppbestpractices.com curator)
Only true for some features, plus constexpr was only limited NOT useless.
o.O that has escalated quickly
Dima
well I can't disagree too, that stuff should be firstly in cxx
Anonymous
S.
/report spam?
Ariana
Ariana
oops
Ariana
ah