Is C++ better than C?

Is C++ better than C?

Tsoding Daily

2 месяца назад

42,789 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@deanlonagan1475
@deanlonagan1475 - 24.05.2024 07:03

wtf is this You Tube..I had to click the You Tube icon again and again to get this one vid and an add and Ive already Dont Recommened this video before that I dont want to watch...I dont want to watch it...its boring...why repeat it so many times?..its the only video on the screen for me to watch...you have reduced the amount of vids I see down to 0-4 vids and most are boring or not in English or have repeated and repeated and repeated or its evil sick content..when can I watch you tube with a full screen of videos...and its not my fault you have boring or evil content..

Ответить
@MrMeltdown
@MrMeltdown - 23.05.2024 09:49

In the earliest c++ you could write to the this ptr when you wanted to do in place new….

Ответить
@TechTutor429
@TechTutor429 - 23.05.2024 07:10

Great

Ответить
@wlcrutch
@wlcrutch - 21.05.2024 18:38

No.

Ответить
@jimishukurow2286
@jimishukurow2286 - 20.05.2024 19:23

F@ck you, JAVA and JAVASCRIPT are the same ... F@CK YOU ... :)

Ответить
@pemrograman-cepat3393
@pemrograman-cepat3393 - 19.05.2024 11:12

Wow. Your title is always legit 😮

Ответить
@FDominicus
@FDominicus - 18.05.2024 15:38

Maybe you like to make this session with D? Or Objektive -C?

Ответить
@FDominicus
@FDominicus - 18.05.2024 15:28

As long as I can avoid C++ I will. And I can't see a change to needing it in my forseeable future.

Ответить
@lukefidalgo8154
@lukefidalgo8154 - 17.05.2024 14:18

no

Ответить
@saidwho9891
@saidwho9891 - 16.05.2024 20:27

one of the big issues you gonna have with C++ variadic templates is the error messages lol, that's why i think instead you can have parameter pack of Task*... args

Ответить
@Argoon1981
@Argoon1981 - 16.05.2024 16:14

I personally code c++, more or less in a C like way, using C++ ism's where they make sense and my life easy or where C ism's aren't supported, not cout/cin or streams either, printf all the way. I follow what is called unorthodox c++.
I'm not saying is the absolute best way to code c++, is the way I like to code and the way that makes me happy and more productive and that is it.

Ответить
@danopamine
@danopamine - 16.05.2024 11:38

haha not a fan of python myself but you joke ranting about mentioning "a toy language like python when discussing system languages" just remined me of John Carmack who was asked what programming language he currently loves the most and he responded with python lol :D

Ответить
@TurtleKwitty
@TurtleKwitty - 16.05.2024 06:25

To be fair to Bjarne, early C++ was crosscompiled to c so it would literally be a superset and full interop and then it stuck haha

Ответить
@MrKevinontube
@MrKevinontube - 16.05.2024 04:33

Script tcl Bebe has got your back.

Ответить
@John-yg1cq
@John-yg1cq - 16.05.2024 01:59

I guess the next logical step is to define a pointer to another class that is kept in the application state that contains those function pointers instead of the built-in vtable, and then leverage C++ shenanigans to make that easier?

Ответить
@xravenx24fe
@xravenx24fe - 15.05.2024 23:30

A lot of these academic types like Bjarne simply rub elbows with the right people and network to get speaking gigs for huge payouts like politicians do. I guarantee he makes at least tens of thousands a year, probably thousands minimum, just to show up and speak at places and do conferences and whatnot.

Ответить
@rogo7330
@rogo7330 - 15.05.2024 16:55

One thing why people talk about C as "old" and "hard" just because libc is very old, full of bugs and most of the times inconvinient. I personally reference to it as "undefined code with global states library". Thankfully POSIX does include functions where you can provide a pointer to an instance of the state, thus having ability to do several things at the same time, but it is not everything at it honestly should be the default.
If Python would not had a lot of predefined classes for strings and stuff it would be very annoying language to write in. Standart library of the language is the language these days.

Ответить
@nordgaren2358
@nordgaren2358 - 15.05.2024 13:42

Oh no. Does he find out that vtables aren't FFI safe in this video?

Ответить
@MrOnePieceRuffy
@MrOnePieceRuffy - 15.05.2024 12:28

Whats this Question? A good language has a string class. Case closed.

Ответить
@dutchdykefinger
@dutchdykefinger - 15.05.2024 10:37

i started C++(11) not too log ago, i already knew some ansi C and dabbled in arduino C

i think half of my c++ shit is just old C library shit at this point lol
i do use strings here and there, but there's plenty of c_str() and char* still going on :D

i don't use classes either, i'm just using good old structs and pointers, wrapped in namespaces
i do like the namespaces paradigm a lot for organizing my codebase, so the namespaces kind of act as (strictly public) " classes".

right now i'm working on a 2d (cpu only) engine with SDL2, i guess i'm a bit of an odd one out still using mingw32-64 at this point
i just started diving into pthreads yesterday and i'm making gigantic strides in performance now i can tap into my entire cpu :D

i'm really having a blast so far, i do have my C background so everything comes pretty easy to me and most has been a breeze and i'm pretty fucking chuffed with myself lol

Ответить
@alanwest6949
@alanwest6949 - 15.05.2024 09:32

Yes.

Ответить
@Rose-ec6he
@Rose-ec6he - 15.05.2024 08:55

You missed out linking the source in the description today, i dont know if that was intentional or not. I personally find it extremely valuable, i have learnt so much from being able to follow along with your process by video and consulting your source when I mess up any details or want a rough idea of conventions to follow. Obviously, I don't expect this of you but if this was a slip-up, here's your opportunity to fix it.

Anyway, love your content. Thanks again

Ответить
@friedrichmyers
@friedrichmyers - 15.05.2024 07:36

My rule is simple.

Write C in C++ and if things needs to be bananas, use C++ features. I still don't write classes unless I HAVE to. I don't use the new C++ std library functions unless I HAVE to.

Ответить
@BobChess
@BobChess - 15.05.2024 05:20

C++ can do C but C can't do C++

Ответить
@prof.dr.davidbuzatto
@prof.dr.davidbuzatto - 15.05.2024 05:06

I'm a C enthusiast and the only thing I miss is a standard implementation of the elementary data structures like lists (stack, queue, deque, list), priority queues, sets and symbol tables (red-black trees and hashtables).

Ответить
@ominusliticus8264
@ominusliticus8264 - 15.05.2024 05:01

Not sure if you'll read, but to use `std::vector<std::unique_ptr<Task>>`, your plug_update function should call `std::make_unique<Task>(Move_Vec2(...))` for every new task, instead of `new Move_Vec2(...)`. The cleanest way is to then use fold expressions and `push_back` or `emplace_back`

Ответить
@maxpoulin64
@maxpoulin64 - 15.05.2024 03:22

I think the proper solution for the state preservation would be a custom allocator that keeps tracks of allocations like React hooks work: when reloading, the allocator just hands back out the same allocations in the same order so your state is preserved. Then you also get to detect when the data layout changes and force a full reload if the number of allocations change or the requested size changes. It still would break the objects though, so you'd also need to only do that for the state and have a separate struct just for state so you don't overwrite the vtable pointer.

Fundamentally hot reloading native code without breaking pointers is hard.

Ответить
@misisumegi6138
@misisumegi6138 - 15.05.2024 03:13

im not 100% sure i assume it crashes because you unload the dynamic library and thus the pointer to the vtable is invalidated (sorry i didn't fully watch the previous episodes) to update to it i think the simplest way would be to create a copy of each element but there are 2 problems
1 there are no virtual copy constructors
2 you cannot use polymorphism because the vtable is outdated at minimum

now the best way i can think of solving this is creating a copy factory function that auto registers new classes using CRTP and identifies types using typeid but im not sure if it would work i will try to implement it by the next vod and report about it

Ответить
@rssszz7208
@rssszz7208 - 15.05.2024 02:08

Am learning cpp hope it helps😅

Ответить
@hughjass6928
@hughjass6928 - 15.05.2024 01:36

Short answer is yes

Ответить
@nobodyspecial1553
@nobodyspecial1553 - 15.05.2024 01:12

I just like writing code in C. That is all. I make no claims about superiority. I'm a guy who programs for pleasure. 😏

Ответить
@michaelmas9817
@michaelmas9817 - 15.05.2024 01:10

yeah yeah, Java is just a subset of JavaScript

Ответить
@dvillegas
@dvillegas - 15.05.2024 00:27

Oh god not Qt, anything but that, we have a legacy app at work on Qt, I have no fucking clue what it does or how it does it and touching it terrifies me everytime

Ответить
@nordgaren2358
@nordgaren2358 - 15.05.2024 00:06

I recently had to model C++ "inheritance" into Rust, so that I could "make" C++ structures in Rust for patching Elden Ring.

It was pretty cool! There's some pain points in Rust. Mostly just stuff that has to be done manually. I could imagine C is even more painful in that regard.

Ответить
@patrickjdarrow
@patrickjdarrow - 14.05.2024 23:59

Me watching this as a python script kiddie 👁️👄👁️🍼

Ответить
@levvayner4509
@levvayner4509 - 14.05.2024 23:59

It's amazing how much effort you can exert if you don't want to write a few lines of CSS to achieve the same goal.
Great video!

Ответить
@redheavenhero7709
@redheavenhero7709 - 14.05.2024 23:45

The reason behind inability to compile program with std::vector<std::unique_ptr<Task>> is an extremely messy design of initializer_list in C++ which poorly supports move-only types. And as far as I know C++ standardisation commitee explicitly refused to fix it.

Ответить
@kibels894
@kibels894 - 14.05.2024 23:23

I work on a project with a C engine and C++ plugins. If you don't care about what happens with exceptions/signals it's fine but shit gets messy when it has to cross from one runtime to the other and back.

Ответить
@user-do4fm1nz2f
@user-do4fm1nz2f - 14.05.2024 23:17

There is an useful technique called CRTP - static polymorphism. It allows you to write compact OOP code and doesn't raise problem with func pointers invalidation.

Ответить