Dima
oh, ouch, I've been coding on C
Mihail
StackOverflow
Sasuke
Google
Asking for Real human experience
Mihail
?
Sasuke
Never mind
Mihail
Also cppreference is a good reference for C++ (afaik they also have C, but I haven't used that much)
Sasuke
🐰🐾 سمیه
What do u mean ?
I didn't know C is like a dark world.
Sasuke
Exactly. It's a reference
Hmm am new to programming so don't know many things as of now
Ибраги́м
I didn't know C is like a dark world.
C is like a dark world. You mean C IS A DARK WORLD ?! It's now used only when: - You DON'T have a C++ compiler. - Someone pointed a gun to your head, 'cos if it's chest u can still opt not to use C - Well... sometimes u have to. Sometimes u need to recorgnise evil before seeing the light, perhaps that's your journey. Are u learning on your own or just school stuffz?
🐰🐾 سمیه
On my own.
🐰🐾 سمیه
It gives one good insight into programming, though.
Ибраги́м
It gives one good insight into programming, though.
This is heresy my dear, this is heresy. Like the American would say: don't drink the kool aid
🐰🐾 سمیه
What this saying means?
Dima
On my own.
I like the motivation
Dima
this is great
Nomid Íkorni-Sciurus
There are some things about C++ that are too complex I think.
Nomid Íkorni-Sciurus
Dima
really?
Dima
uh, what?
https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
Dima
inb4 it should be pinned xD
Dima
rip Maxi
Nomid Íkorni-Sciurus
https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
is that any used in actual enterprise businness?
Dima
well, there are examples
Nomid Íkorni-Sciurus
sounds like not then.
Nomid Íkorni-Sciurus
It's ok XD though I have to say that learning it would be of no use for job
Nomid Íkorni-Sciurus
damn it T_T
Dima
When I have need to use c++ at work I always choose the orthodox way
Dima
well, thats just my taste
14•08
Nomid Íkorni-Sciurus
I mean, it's actually a nice project
🐰🐾 سمیه
🐰🐾 سمیه
While lots of friends are helping me here, how can I give up on it?
Anonymous
/cpp
Anonymous
/cpp
/cpp
Anonymous
#cpp
gbmariz
Does anyone know how to get value from a variable before the program runs in Linux example would be: ./program variable_name Run: Hello variable_name
BinaryByter
yes
BinaryByter
google "c++ argv argc"
Dima
no
Dima
google "c argv argc"
joel
lapastatopelos
Dima
English please
Anonymous
I am rapheal a mechatronics engineering student
klimi
Ибраги́м
https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
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.
Ибраги́м
What this saying means?
Heresy: opinion profoundly at odds with what is generally accepted. drink the kool-aid: demonstrate unquestioning obedience or loyalty to someone or something. There's still a lot of things missing in C. Well, I don;t expect you to spend too much time on it, unless u want to end up with these companies in Germany.
Nomid Íkorni-Sciurus
Ибраги́м
So, what are they and why are they useful?
Since u condemned it u should've known
Nomid Íkorni-Sciurus
Since u condemned it u should've known
I just know it is a thing that C++ only has. There must be a reason
Nomid Íkorni-Sciurus
So, what are they and why are they useful?
Nomid Íkorni-Sciurus
Well I might not be entitled to an answer, but I'm pretty sure that if something is introduced in a language it's because it needs to solve a problem.
Nomid Íkorni-Sciurus
I'll reference this article
Nomid Íkorni-Sciurus
https://www.learncpp.com/cpp-tutorial/15-3-move-constructors-and-move-assignment/
Nomid Íkorni-Sciurus
"Whereas the goal of the copy constructor and copy assignment is to make a copy of one object to another, the goal of the move constructor and move assignment is to move ownership of the resources from one object to another (which is much less expensive than making a copy)."
Nomid Íkorni-Sciurus
Ok. Though, is that really necessary ? I can't think of a case where they're useful, unless you mean very big resources ?
Nomid Íkorni-Sciurus
Is it helpful because C++ doesn't have a garbage collector?
BinaryByter
no
BinaryByter
its helpful because it helps you copy large stuff without overhead
BinaryByter
without too much overhead
BinaryByter
lets say you have a std::vector
BinaryByter
the vector has a T *data
BinaryByter
somewhere
BinaryByter
you could either copy every element
BinaryByter
or just do myVec.data = other.data other.data = nullptr
Nomid Íkorni-Sciurus
Hm...
BinaryByter
(thats how the move overload for std::vector works internally)
Nomid Íkorni-Sciurus
isn't that harmful with such large sizes?
Nomid Íkorni-Sciurus
I mean, delegating the resource management involves more operations to be done
Nomid Íkorni-Sciurus
that sounds like a paradox
BinaryByter
no, the resource management is still done by std::vector