Unreasonable Effectiveness of Abstractions

  Рет қаралды 30,635

Tsoding Daily

Tsoding Daily

3 ай бұрын

Previous Episode: • Raylib.js
References:
- raylib.js - github.com/tsoding/raylib.js
- Tsoding - Snake - tsoding.github.io/snake-c-wasm/

Пікірлер: 62
@nulligor
@nulligor 3 ай бұрын
sounds good sounds gud sounds gucci sounds a-tamagutchi a-letsa-go
@jesusmgw
@jesusmgw 3 ай бұрын
Compile mutha flippa!
@jamesmay2083
@jamesmay2083 3 ай бұрын
*dabs*
@SlinkyD
@SlinkyD 3 ай бұрын
can your $insert_noun_here do that?
@valshaped
@valshaped 3 ай бұрын
20:15 Hi! Infosec people here: if you use printf(s) You're passing s as the format string parameter. The function uses the format string to interpret *raw bytes on the stack* as types of data to be formatted, and one format specifier in particular, %n, will actually write the number of characters printed so far to a variable on the stack. If you allow arbitrary user input as a format string parameter, that user input can print some garbage and then *write the printed length to the return address,* jumping to (nearly) arbitrary memory addresses.
@TsodingDaily
@TsodingDaily 3 ай бұрын
Damn, I should try to do that!
@phitc4242
@phitc4242 3 ай бұрын
on termux %n doesn't work
@benisrood
@benisrood 3 ай бұрын
wheeeeeeeeee
@tekno679
@tekno679 2 ай бұрын
This %n can be used together with a buffer overflow and an index x like this `%x$n` to write arbitrary data to any arbitrary address(es?). This is a common challenge in pwn ctf challenges.
@thenwhoami
@thenwhoami 3 ай бұрын
For someone who is interested in grasping a lower level understanding of the stack, your channel is a gold mine.
@John-yg1cq
@John-yg1cq 3 ай бұрын
What I love about the philosophical question is how it highlights so many interesting points. Firstly, something I noticed that I am seeing more and more is how header files really are just interfaces, and that the underlying implementation is the platform specific code and never had to be C specifically. This is so brilliant because you could implement any C interface in any language that can go through some unified assembly. Then with the GLFW duplication, we really see how the browser is a sandbox and something like Emscriptem is a sandbox, and since you're going with a sandbox on top of a sandbox, you need the same abstraction. While just going browser native (which is JavaScript) you can skip the second sandbox. Furthermore this approach also highlights how we should maybe break up the C standard library into more unified single header files (ala STB) so that it's even more portable. Maybe even something like the D language modules combined with native JavaScript becomes super interesting for file size. Man, this little idea is SO COOL!
@guillemgarcia3630
@guillemgarcia3630 3 ай бұрын
Im loving the thumbnails ❤
@soniablanche5672
@soniablanche5672 3 ай бұрын
fun fact: You can do type punning in javascript with typedarrays
@xesau
@xesau 3 ай бұрын
Honestly your channel is just one big tutorial on refactoring
@ihspan6892
@ihspan6892 3 ай бұрын
Sir, you are a great wizard!
@Wilfried-uw2uu
@Wilfried-uw2uu Ай бұрын
This channel is so underrated. I tell about hi to everyone I l know. time to bring bakc the good old days of people truly understanding the code they write
@potatopassingby1148
@potatopassingby1148 3 ай бұрын
nice thumbnail! definitely pulled me 😂
@flexzuu
@flexzuu 3 ай бұрын
I wonder how this whole thing would look if you try to move the cut line one layer down (to the platform thing in your drawing). And maybe have a WEB_CANVAS platform or a a WEB_GPU platform. But i maybe the issue may be that platform in raylib depends on too much stuff you would need to implement then.
@SlinkyD
@SlinkyD 3 ай бұрын
Filled 'em rect 'um
@berndeckenfels
@berndeckenfels 3 ай бұрын
I don’t like to move the font logic into the abstract game engine, since it will not know about all platform capabilities (like why not use browsers alignment which might be aware of micro kerning)
@Vulto166
@Vulto166 3 ай бұрын
I'm interested to know how much Tsoding cares about reverse engineer programs.
@GK-rl5du
@GK-rl5du 3 ай бұрын
@Tsoding building a process sandbox from scratch.. sounds like a cool idea 💡?😊
@AntonioDellaRovere
@AntonioDellaRovere 3 ай бұрын
const char *s is not a pointer to a string per se, it is rather a pointer to unsigned bytes in memory. With "%s" you instruct printf() how to treat those bytes. It will print them out one byte after the other as ascii character until it reaches a zero termination byte.
@hwstar9416
@hwstar9416 3 ай бұрын
1:00:18 btw Rust (also added in C23) have unreachable. Which basically tells the compiler this branch is never reached and the compiler can make optimizations based on that. For example: void foo(int *ptr) { if( ptr == NULL ) unreachable(); /* rest of function */ }
@GuerreroMisterioso95
@GuerreroMisterioso95 3 ай бұрын
Why add a branch condition that will never be reached?
@origamitraveler7425
@origamitraveler7425 3 ай бұрын
you're basically telling the compiler to induce undefined behavior in the case of it happening, for optimization purposes, I think
@origamitraveler7425
@origamitraveler7425 3 ай бұрын
like, formally it should never happen, but in practice it might
@hailuong9295
@hailuong9295 3 ай бұрын
Btw Zig has unreachable keyword long before Rust and C even introduce them, the goal is tell the compiller in release mode "remove this check as i already sure this code cannot be reach, and i fine undefined behaviour happpen if this branch get execute"
@hwstar9416
@hwstar9416 3 ай бұрын
@@origamitraveler7425 yup that's exactly it.
@Nextdesu
@Nextdesu 2 күн бұрын
About type punning, i dont know c but shouldnt your color type be a union? Than you can treat it as both a struct and u32 and explicitly indicate this.
@ltxr9973
@ltxr9973 3 ай бұрын
Oh ok, the thumbnail made me think you've written a C compiler in javascript
@matteovalentino4890
@matteovalentino4890 3 ай бұрын
Nice
@KoltPenny
@KoltPenny 2 ай бұрын
24:50 They also didn't know about how basic memory handling works so they invented "a memory safe language". The result is a complainer (like them), not a compiler.
@vanviccardi7553
@vanviccardi7553 3 ай бұрын
nice
@blackhaze3856
@blackhaze3856 3 ай бұрын
Where is the discord announcement? Sad 😔
@mr.j0159
@mr.j0159 3 ай бұрын
Tsoding is a proud romanian.
@Seedwreck
@Seedwreck 2 ай бұрын
Susha moment
@zero3juan
@zero3juan 3 ай бұрын
lol includes a library to downcase a letter instead of subtracting 26? love your videos, btw
@alh-xj6gt
@alh-xj6gt 2 ай бұрын
13:40 .. ohh man .. here I am for your merit in C code, emacs magic, approach and explanation. If I want to see someone read or nearly scream way waaay too much chat with a loud clown voice - like those hyper hotel kindergarten entertainers - I would watch thePrimeagen. Irony aside if there is a slight hint of pressure to perform like a class clown, please don't feel pressured, there will be viewers that appreciate your work more than pulling up chat every 200-400 seconds - like a bad advertisement reel that is unskippable - with the streamer nearly peaking the mic every 10-30 seconds throughout the 1-4 Minute "chat interaction".
@D-V-O-R-A-K
@D-V-O-R-A-K 3 ай бұрын
Why not make a C program that transpiles raylib to js automatically?
@anonymousanon4822
@anonymousanon4822 3 ай бұрын
Because that's magbitudes harder than just doing it by hand
@homelessrobot
@homelessrobot 3 ай бұрын
or a js program that just transpiles c to javascript. then we can just transpile linux to ms-edge
@anon_y_mousse
@anon_y_mousse 3 ай бұрын
I think a lot of newer developers don't bother to study history or any tech that they consider "outdated", so of course they won't know of type punning. The sad thing is that it also makes them inferior developers who continuously reinvent the wheel. That's a thin needle to thread, especially given that creating a new programming language is often viewed as reinventing the wheel even when it's not, but the most obvious example I can think of is when a solution has to be reverse engineered for a problem that has already been solved by another language. If you just copy their solution and then move on from that point, then great, but it's when a programmer doesn't know the solution already exists that causes problems. As a corollary to that problem, you also have developers that don't keep up to date with their skills and try to solve problems in a new way when a better way exists in another language. Consider every developer that tells me C doesn't do this or that and then says their language of choice solves that issue that was already solved in an earlier C standard, sometimes C99, oftentimes C11, but the most ridiculous is when it involves C++ and they've never even heard of Boost, never mind what the committee has been doing in the past 25 years.
@TheMelopeus
@TheMelopeus 3 ай бұрын
Is it the fault of new developers when there is just so much to learn it's impossible to know what you need to know to become a good developer without being a good developer so there's that :)) People go to what brings them money, if they didn't do that since childhood and played with the pieces for so long they know the lower level stuff it's really difficult for someone just starting out
@anon_y_mousse
@anon_y_mousse 3 ай бұрын
@@TheMelopeus Consider every new language developed in the past decade and a half. Most implementers don't study other languages, even the ones they claim they want to replace, then they end up coming up with an awful solution that was already solved in the language they're attempting to replace and much more eloquently than their new attempt at the problem. Only makes it worse when they claim that language X doesn't do what their fancy new language Y does even when it could already do it for a decade. If a language designer doesn't study history then they'll be doomed to reinvent the wheel and make it square because they like squares more and have to learn what those who came before them learned that a round wheel works better.
@johnm3066
@johnm3066 3 ай бұрын
This is Tsoding, of course he's Russian. The dude is a beast!
@friren_elf
@friren_elf 2 ай бұрын
1:39:33 rand2 :)
@ariemelans7817
@ariemelans7817 3 ай бұрын
Hi Tsoding, i would like to appreciate that if you could make a video of Problems Solving on Codeforces. It would help a lot, thank you...
@matthewchampagne9621
@matthewchampagne9621 3 ай бұрын
Sounds pretty boring
@freemasry-gr8hw
@freemasry-gr8hw 3 ай бұрын
WHAT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!, I want to say to tsoding to calm down if you saw that comment
@ariemelans7817
@ariemelans7817 3 ай бұрын
@@matthewchampagne9621 nah, solving problems are required in this present time bruh
@lolcat69
@lolcat69 3 ай бұрын
FINALLY EARLY TO THE VID!!! (First btw )
@anon_y_mousse
@anon_y_mousse 3 ай бұрын
Looks like three beat you to it.
3 ай бұрын
j ass
@forayer
@forayer 3 ай бұрын
Nice
Can C actually do Perfect Bézier Curves?
2:17:22
Tsoding Daily
Рет қаралды 6 М.
I tried React and it Ruined My Life
1:19:10
Tsoding Daily
Рет қаралды 110 М.
Маленькая и средняя фанта
00:56
Multi DO Smile Russian
Рет қаралды 3,3 МЛН
Зу-зу Күлпәш. Агроном. (5-бөлім)
55:20
ASTANATV Movie
Рет қаралды 615 М.
Is John Carmack Right about UI?!
1:52:02
Tsoding Daily
Рет қаралды 29 М.
I regret doing this...
1:20:07
Tsoding Daily
Рет қаралды 60 М.
Improving Learn OpenGL's Text Rendering Example | Adventures in Coding
1:02:45
Whatever's Right Studios
Рет қаралды 4,5 М.
I made JIT Compiler for Brainf*ck lol
3:07:56
Tsoding Daily
Рет қаралды 68 М.
Is C++ better than C?
1:46:10
Tsoding Daily
Рет қаралды 27 М.
the new PS4 jailbreak is sort of hilarious
12:21
Low Level Learning
Рет қаралды 25 М.
Torvalds Speaks: Rust's Impact on the Linux Kernel
3:50
Mastery Learning
Рет қаралды 540 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 922 М.
Searching Duplicate Files with C
2:39:23
Tsoding Daily
Рет қаралды 34 М.
Hiding Data Inside of Executable Files
1:55:14
Tsoding Daily
Рет қаралды 24 М.
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 3,9 МЛН
Samsung or iPhone
0:19
rishton vines😇
Рет қаралды 6 МЛН
Индуктивность и дроссель.
1:00
Hi Dev! – Электроника
Рет қаралды 931 М.