klimi
Well I mean learning in depth... But... Ya, basics might not be hard, but also are not much different from C
klimi
Whatever my perl is <3
Vlad
Not much but it is there
Lack of templates for example makes you store void* in containers and malloc more things than you would otherwise in C++. Which is additional indirection and performance hit for C code
klimi
It seems you're more experienced, I am just a python dev ¯\_ (ツ) _/¯
Igor🇺🇦
Maybe virtual functions and what not
That's wrong comparison IMHO. You need to COMPARE the same functionality implemented in different languages. How can you implement dynamic dispatch in C more efficiently?
Vlad
The same way why most people cant write better asm than the compiler
Mar!o
The same way why most people cant write better asm than the compiler
For SIMD it's not even that hard to write better asm than the compiler
Vlad
For SIMD it's not even that hard to write better asm than the compiler
That is if your architecture has simd. And you're smart enough to use it
Vlad
But yeah comparison is kinda bs I agree
Pavel
No you're not losing performance. You have the same level of low level access as C. And I bet std library implementation is better than whatever internal library generic company can write.
Well, about libraries, companies can do better for their specific needs. I mean they can trade e.g. some portability, but make a more performant container for their specific cases.
Vlad
Well x86 and ARM both have SIMD
And you wouldn't probably write asm for it anyway. Unless you need simd
Bruno
What templates in C?🤔
Sorry, i mean container
Ishikawa
Native of drawing GUI is system dependent. More closer to metal your code is, less portable it becomes.
Someone told me a while ago that the best one can do is to make own operating system and start creating libraries all from scratch. Is it really the only way if at all it is ?
Ishikawa
You can do gui in C but it shall be pain the arse. And why would you anyway
Okay, If I'm ready for the pain, how can it be done ? I bet it can't be worse than COBOL, which we were forced to learn in high schools. So please give me a push me in the right direction ?
Anonymous
Maybe virtual functions and what not
If you need virtual functions in C, they will have the same overhead or even more, so it's not an overhead
Anonymous
Any book recommendation for self study c/c++
Anonymous
can I ask some off topics things here? or any group for that ? It's related to software engineering.
klimi
C++ is as fast as C
I was told otherwise
Pavel
That's really what I'm trying to ask - how do those libraries do it ?
I'm not 100% sure but I think they use platform-specific APIs like WinApi for Windows.
Anonymous
klimi
Bad for you
If you say so
Hadaward 'Solly'
C++ and C at 80km/h. Who do you think can go faster? :thonk:
Ishikawa
Only difference I've ever seen is in compilation time, never in execution.
Anonymous
Only difference I've ever seen is in compilation time, never in execution.
C++ definitely sucks in compilation times but sometimes it improves C++ runtime over C
klimi
What about rust
Anonymous
What about rust
It's offtopic
Anonymous
:))
Hadaward 'Solly'
good leave
Ishikawa
I mean how does it improve runtime ?
Anonymous
I mean how does it improve runtime ?
Improving runtime = longer execution time?
Hadaward 'Solly'
no
Anonymous
no
Sounds wrong
Anonymous
Did you assume that improvement meant it'd execute faster?
Hadaward 'Solly'
also no
Hadaward 'Solly'
it might do some optimizations to loops etc
Hadaward 'Solly'
faster execution isnt deterministic
Pavel
I think it depends on what we're measuring. I think if someone tries to write something simple and superoptimized there won't be big differences But if it's something simple but written without thinking about performance, then C can be faster (because you will have to think about it there). If it's something big/complex and made with performance in mind, then C++ solution can be faster. Because writing in C++ you have better abstractions, more time to think about scalability, more tools to move stuff to compile-time instead of runtime. It basically frees your hands from problems you don't need to think about and you can concentrate on things that matter.
Anonymous
How exactly does it do that ?
To build a generic library in C you have to use void* (example: qsort function) — which forses you to do at least one more memory indirection To build a generic library in C++ you should use templates — they don't give such an overhead as C + they can be optimized more for the specific types you have + for example comparator for std::sort can be inlined easily, for qsort it'll be never inlined probably though
Anonymous
C++ gives more information for a compiler to optimize a program
Vlad
Also you can rasterize your triangles in software if you're so inclined
Hadaward 'Solly'
was that pun intended
Ishikawa
Opengl exists
Exactly what I'm trying to ask, how does opengl tell the machine that it needs to draw a rectangle, are there instruction sets specially for those kind of things specially ?
Pavel
But lets say if I want to tell the machine to draw a rectangle, how would I have to tell it ? Also, is it something CPU alone cannot do ?
Ok, let's see. You want to draw a rectangle, for this you need to have a window probably, you need to ask your operation system (or desctop environment?) to create a window for your app. In windows you probably will do something similar to this http://www.winprog.org/tutorial/simple_window.html Then to draw a line you can search for the API function for that or use something like opengl to draw your primitives there.
Vlad
And gpu driver knows how to draw a triangle on its hardware
Ishikawa
So GPU is what draws windows as well.
Ishikawa
And gpu driver knows how to draw a triangle on its hardware
Can you please direct me to a lecture or a book related to this? Or a post? Or just what should I type in Google to get info on this
Ishikawa
Thank you very much.
Igor🇺🇦
Thank you very much.
More links are available here: https://legends2k.github.io/note/cg_resources/
Ishikawa
Thank you very much. I really appreciate it.
Aakash
But lets say if I want to tell the machine to draw a rectangle, how would I have to tell it ? Also, is it something CPU alone cannot do ?
There are forums available for graphics talks! learn more on X.org — here how it’s works (Generic): H/W(Card)—>DDI/DKI(device-driver)—>DRI(rendering engine)—>Xlibs(system libraries)—>Open/MesaGL—>User You may study details here.. https://www.x.org/wiki/guide/concepts/
Ishikawa
Link some forums please
Ishikawa
Also, are there any telegram groups for that ?
Aakash
All computers in world are SIMD; SISD old pipeline, outdated. MISD, can be created, but face serious architectural issues. MIMD; best examples are multi-socket multi bus plane arch. Very high end.
Aakash
Link some forums please
Visit x.org you will find lot there..
Ishikawa
Ok, thank you very much
Anonymous
Any body here c++ programmer ??
Chinepun💛
Anonymous
AG7💛 thanks ❤❤
peppez
Hello
peppez
Could you help me with a program in c?
klimi
Could you help me with a program in c?
Depends on whata is the problem