Unreasonable Effectiveness of Abstractions

  Рет қаралды 31,048

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?
@thenwhoami
@thenwhoami 3 ай бұрын
For someone who is interested in grasping a lower level understanding of the stack, your channel is a gold mine.
@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 3 ай бұрын
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.
@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!
@soniablanche5672
@soniablanche5672 3 ай бұрын
fun fact: You can do type punning in javascript with typedarrays
@guillemgarcia3630
@guillemgarcia3630 3 ай бұрын
Im loving the thumbnails ❤
@xesau
@xesau 3 ай бұрын
Honestly your channel is just one big tutorial on refactoring
@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
@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
@ihspan6892
@ihspan6892 3 ай бұрын
Sir, you are a great wizard!
@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.
@potatopassingby1148
@potatopassingby1148 3 ай бұрын
nice thumbnail! definitely pulled me 😂
@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.
@blackhaze3856
@blackhaze3856 3 ай бұрын
Where is the discord announcement? Sad 😔
@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.
@ltxr9973
@ltxr9973 3 ай бұрын
Oh ok, the thumbnail made me think you've written a C compiler in javascript
@Nextdesu
@Nextdesu 19 күн бұрын
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.
@KoltPenny
@KoltPenny 3 ай бұрын
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.
@matteovalentino4890
@matteovalentino4890 3 ай бұрын
Nice
@vanviccardi7553
@vanviccardi7553 3 ай бұрын
nice
@mr.j0159
@mr.j0159 3 ай бұрын
Tsoding is a proud romanian.
@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
@Seedwreck
@Seedwreck 3 ай бұрын
Susha moment
@alh-xj6gt
@alh-xj6gt 3 ай бұрын
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".
@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.
@zero3juan
@zero3juan 3 ай бұрын
lol includes a library to downcase a letter instead of subtracting 26? love your videos, btw
@friren_elf
@friren_elf 3 ай бұрын
1:39:33 rand2 :)
@johnm3066
@johnm3066 3 ай бұрын
This is Tsoding, of course he's Russian. The dude is a beast!
3 ай бұрын
j ass
@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.
@forayer
@forayer 3 ай бұрын
Nice
Wait, but Who's Debugging the Debugger?!
59:53
Tsoding Daily
Рет қаралды 33 М.
I regret doing this...
1:20:07
Tsoding Daily
Рет қаралды 62 М.
Omega Boy Past 3 #funny #viral #comedy
00:22
CRAZY GREAPA
Рет қаралды 34 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 147 МЛН
Тяжелые будни жены
00:46
К-Media
Рет қаралды 5 МЛН
Hare Programming Language
1:39:25
Tsoding Daily
Рет қаралды 46 М.
The Truth about Rust/WebAssembly Performance
29:47
Greg Johnston
Рет қаралды 169 М.
Hiding Data Inside of Executable Files
1:55:14
Tsoding Daily
Рет қаралды 24 М.
Why is Raylib becoming so popular?
9:24
Chris_PHP
Рет қаралды 14 М.
Reviewing Your Pull Requests
1:39:37
Tsoding Daily
Рет қаралды 25 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 962 М.
Will Ada Replace C/C++?
44:57
Tsoding
Рет қаралды 79 М.
2 Years Of Learning C | Prime Reacts
22:24
ThePrimeTime
Рет қаралды 237 М.
John Carmack Tech Talk with UMKC-SCE
1:20:28
UMKC School of Science and Engineering
Рет қаралды 247 М.
Virtual DOM for Your Terminal
1:44:03
Tsoding Daily
Рет қаралды 38 М.
Обзор игрового компьютера Макса 2в1
23:34
Индуктивность и дроссель.
1:00
Hi Dev! – Электроника
Рет қаралды 1,6 МЛН
как спасти усилитель?
0:35
KS Customs
Рет қаралды 522 М.
iphone fold ? #spongebob #spongebobsquarepants
0:15
Si pamer 😏
Рет қаралды 530 М.
Xiaomi Note 13 Pro по безумной цене в России
0:43
Простые Технологии
Рет қаралды 2 МЛН