Soni
I am practicing
Anonymous
Soni
In my laptop
Anonymous
Lmao
Антон
Типикал C++, приветствует ошибки
Afosa
Can someone help me with algorithms for building a communication application?
Roxifλsz 🇱🇹
/warn referral link
Roxifλsz 🇱🇹
Sloooooow
Stnby
Oh you're here as well xD
Roxifλsz 🇱🇹
I've been here since forever
Roxifλsz 🇱🇹
Since 300 members I think
Stnby
C > C++
Anonymous
Roxifλsz 🇱🇹
C > C++
For my use cases, yeah, I just want easy C interop in other langs
Stnby
Whats this?
Pavel
C > C++
false C++ is postincrement, so the values are equal, so the expression is false ;p
Anonymous
Whats this?
I thought there was gonna be some good ol arguments , so it's betteer to move to OT group 😅
Stnby
Stnby
that people actually use
Stnby
I am still surprised how it is possible to have C and C++ in the same place as both are very different languages
Stnby
I am fine with classes but whats up with streams :D
Anonymous
What else is useless in C++? Function overloading? Templates?
Anonymous
They even are not compatible
Stnby
They even are not compatible
They are not compatible but very easy to port C to C++ but not the other way around
Diego
I like C++ better when I need to work with C/C++ to build something, but for interop C is so much simpler
Anonymous
They are not compatible but very easy to port C to C++ but not the other way around
When you port normal C code to C++ without refactoring, you get shitty C++ code
Stnby
Also I find it way more easy to understand C as it doesn't hide things within constructors etc
Stnby
looking at complicated C++ code is painfully difficult for me
Anonymous
I like C++ better when I need to work with C/C++ to build something, but for interop C is so much simpler
Some libraries are written in C++ but expose C interface For example — Intel Media SDK
Anonymous
I like C++ better when I need to work with C/C++ to build something, but for interop C is so much simpler
Also there's an interesting project https://github.com/metacall/core
Diego
looking at complicated C++ code is painfully difficult for me
The only thing I find complicated about C++ is when it throws undefined reference to vtables when the functions are defined in the derived class, but other than that, just take your time reading about it lmao
Anonymous
There was C support Don't know if that part is still supported
Stnby
Some libraries are written in C++ but expose C interface For example — Intel Media SDK
for example imgui is an example of useless usage of C++ it has 1 class and is super difficult to get it working in C
Diego
If it helps, you can try your hand at OOP in a simpler language like C#, and then expand on that knowledge with C++
Anonymous
looking at complicated C++ code is painfully difficult for me
How many years did you write code with C++?
Stnby
after that I wrote only C
Anonymous
only in highschool
So, it's better to don't commenting.
Diego
for example imgui is an example of useless usage of C++ it has 1 class and is super difficult to get it working in C
You know you can write procedural code in C++ right It's not quite C but simple enough
Stnby
So, it's better to don't commenting.
I used both and my preference is C although I like C++ as well
Diego
only in highschool
If you didn't give it a real chance then you have no business complaining about it
Stnby
If you didn't give it a real chance then you have no business complaining about it
It is hard to get used to completely different workflow coming from C
Anonymous
There's no CRTP in other languages, is there?
Diego
oop is complex, it doesn't matter what language you choose
It does, actually The whole point of languages like C# and Java is to simplify everything OOP in C# is hella different from C++
Stnby
anyone knows some good resources?
Stnby
As even if I know C++ syntax I still have C thinking
Diego
anyone knows some good resources?
https://www.cplusplus.com/reference/
Stnby
how to write Well structured C++ code
Anonymous
As even if I know C++ syntax I still have C thinking
- The C++ Programming Language. Also read this: https://www.stroustrup.com/new_learning.pdf For a quick look: - A Tour Of C++
Anonymous
how to write Well structured C++ code
Use 1. Modern Effective C++ book (and other books from the same author) 2. C++ best practices on GitHub 3. C++ Core Guidelines 4. Conference talks by Kate Gregory, Jason Turner and others
Stnby
Thank you
Diego
There's no CRTP in other languages, is there?
I just read about it Isn't that similar to: C# public class SomeClass<T> where T : class { } public class SomeOtherClass : SomeClass<SomeOtherClass> { }
Anonymous
how to write Well structured C++ code
At first, you could do whatever you want to do. But for Well Structured C++ Code, you need some rules: - C++ Core Guide Line. - MISRA (For critical systems) - CERT (For sercurity notes) Also is really good to read the Effective C++ from Scott Mayer.
Anonymous
Diego
And yes, I know templates and generics are very different concepts
Diego
It even works if you constrain T to be SomeClass
Anonymous
Because C stimulates to write bad code
It stimulates to type more
Anonymous
It stimulates to type more
And shoot in leg more
Anonymous
I actually used c++ in a c project just so i could use namespaces. That was a lot of extern C typing.
Anonymous
But damn, I can't handle a variety of functions right in the main namespace, so it was worth
Diego
Templates in C++ and Generics in C# work very different And I don't know if this code would compile in C#
https://dotnetfiddle.net/gAorGo I totally get that templates work differently, but I'd appreciate an explanation as to why this wouldn't serve a similar purpose, thank you!
Anonymous
How CRTP related to OOP?
It provides static polymorphism