Explaining Pointers Until I Go Insane

  Переглядів 104,433

Mults

Mults

16 днів тому

To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/Mults . You’ll also get 20% off an annual premium subscription.
Hello there! I've been wanting to talk about quirky pointers for a while. They make no sense sometimes.
Music used in the video:
- Sewer surfing: • TMNT 4 (SNES) Music: S...
- Flower garden: • Yoshi's Island OST - F...
- Vordt of the Boreal Valley: • Vordt of the Boreal Va...
- Pizza Parlor: • Club Penguin - Pizza P...
- Figure-8 Circuit: • Mario Kart DS Music - ...
- Mii Channel Theme: • Nintendo Wii - Mii Cha...
- The Cyber Sleuth: • The Cyber Sleuth - Dig...
- Bad Bully: • Kizumonogatari II ost ...
- Wii Sports - Title: • Wii Sports - Title (HQ)
- Spark Mandrill: • Mega Man X OST - Spark...
- Hope Ster: • Hope Ster - Digimon St...
- Flame Mammoth: • Megaman X - Flame Mamm...
- Alleycat Blues: • TMNT 4 (SNES) Music: A...
- Listen!!: • K-ON! - Listen!! Instr...
- Going Up: • TMNT 4 (SNES) Music: G...
- Still, Move Forward: • Still, Move Forward! (...
- Royal Knights: • Royal Knights - Digimo...
- A Dish is Best Served Cold: • Tee Lopes - A Dish Bes...
- ミカヅキBIGWAVE -Emotional Prism 感情的なプリズム: • ミカヅキBIGWAVE - Emotiona...
This video was sponsored by Brilliant.
#Mults

КОМЕНТАРІ: 430
@MultsElMesco
@MultsElMesco 15 днів тому
Hello everyone! I've been doing some mix and match with my content style lately. Just trying new things. Let me know what you think :) To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/Mults You’ll also get 20% off an annual premium subscription.
@mxblock
@mxblock 11 днів тому
Not a regular viewer (yet), but - This right here is literally a master piece for me. Educational, something interesting, memes (not to in you'r face / loud audio - still prominent to be entertaining), relatability, the ever growing crazieness, straight to the point, not to short nor to long, right volume for music and mic, the outro song - all just perfect. Keep it up!
@tuhkiscgibin6627
@tuhkiscgibin6627 14 днів тому
If a codebase has any of this stuff, you'll know it's been backdoored.
@atomgutan8064
@atomgutan8064 12 днів тому
lol exactly. this is extreme obfuscation
@tuhkiscgibin6627
@tuhkiscgibin6627 12 днів тому
@@atomgutan8064Some Jia Tan shit
@atomgutan8064
@atomgutan8064 12 днів тому
@@tuhkiscgibin6627 lmao this is the new backdoor reference now ig
@avoavoavo
@avoavoavo 12 днів тому
Once committed, always committed. No explanation is needed. It works.
@tosemusername
@tosemusername 11 днів тому
Well, the person who backdoored it understood it, so jokes on you :P
@Spitfire720
@Spitfire720 14 днів тому
Aight I'm never listening to the word "pointer" again
@deltamico
@deltamico 14 днів тому
"pointer" You can read it instead. You're welcome
@nodrance
@nodrance 11 днів тому
I point on her... Wait
@deleteddeleted1940
@deleteddeleted1940 8 днів тому
learn about references!
@jeremymcadams7743
@jeremymcadams7743 7 днів тому
Let me give you a few pointers about how to get over this issue
@vulnoryx
@vulnoryx 13 днів тому
"say pointer again" "fuck you"
@user-qr4jf4tv2x
@user-qr4jf4tv2x 7 днів тому
is that rick and morty
@vulnoryx
@vulnoryx 6 днів тому
@@user-qr4jf4tv2x yes
@ry6554
@ry6554 13 днів тому
Honestly, An array of functions sounds pretty dope. Nevermind, an array of pointers to functions sounds pretty dope.
@VivekYadav-ds8oz
@VivekYadav-ds8oz 12 днів тому
ain't that the same? or are we saying "an array of pointers to function pointers" (effectively double-indirection) in the second one?
@theepicguy6575
@theepicguy6575 12 днів тому
Well, you can't have arrays of functions in the first place Only pointers to functions
@user-uf4rx5ih3v
@user-uf4rx5ih3v 12 днів тому
In C, you actually cannot store functions inside arrays anyway, the compiler will silently convert that code into a pointer to that function instead.
@jrstf
@jrstf 12 днів тому
Is not every C++ member function referenced through an array of pointers to functions?
@pitri_hub
@pitri_hub 12 днів тому
@@jrstf Per default, member functions are just statically compiled into the calling code. But it is true for virtual functions. They are referenced in the vtable, which exists for each type with virtual functions. Each of these objects then has an internal pointer to its respective vtable, which contains the pointers to the implementation defined procedures. This is how dynamic polymorphism is implemented.
@LizardGecko420
@LizardGecko420 10 днів тому
You realize how complicated pointer syntax is when the best explanation of how to read complex statements is in a funny YT video
@Hallilo
@Hallilo 13 днів тому
I honestly never had any issues understanding basic and more advanced pointer stuff, but THIS is some actual good stuff LMAO great video
@ThisShitWontWor
@ThisShitWontWor 11 днів тому
12 years old me learning C++ : "Ok so, its a box containing... a box, ok?, containing a box... fuck it"
@eleinaedelweiss6215
@eleinaedelweiss6215 12 днів тому
Who the hell would write the last one, without questioning their lives decisions.
@James-ne9td
@James-ne9td 11 днів тому
"For example, if I use this struct 'Fucker'" caught me completely off guard XD My main takeaway from this video though is that as a C# dev for Unity, I shouldn't touch C++ with a 5 foot pole or else risk entering pointer hell.
@vibaj16
@vibaj16 11 днів тому
no one actually uses crazy pointer stuff like this. Actually useful pointer stuff is simple and often feels quite elegant.
@happygofishing
@happygofishing 11 днів тому
random swearing is peak reddit humour
@James-ne9td
@James-ne9td 10 днів тому
@@vibaj16 tbf, I was being slightly hyperbolic. I do want to get round to learning C++ eventually but the combination of pointers, header files, garbage collection, and syntax is just a lot.
@user-vt9bp2ei1w
@user-vt9bp2ei1w 9 днів тому
@@vibaj16 It's really simple.... The library will only use (void* buf, size_t n) for ALL types. C believes that smart users know that the void* returned by the function is a specific type among the 100+ custom types, it will be a linklist + table with a specific internal mix of pointers to stack and pointers to allocated heap, and then you have to be careful about pointer casts, linklist iteration, use void* to calculate offsets, of course you will remember which one is CHAR8* string and which is CHAR16* string, finally free the heap allocation and perfectly avoid the pointer to the stack. The biggest advantage of C is that it is suitable for keeping your job.
@user-vt9bp2ei1w
@user-vt9bp2ei1w 9 днів тому
It's really simple.... The library will only use (void* buf, size_t n) for ALL custom types. It is linklist + table with a specific internal mix of pointers to stack and pointers to allocated heap, CHAR8* string and which is CHAR16* string.
@moneteezee
@moneteezee 14 днів тому
im actually glad i found this video, you explained this well and now i know how to interpret those long lines
@dipereira0123
@dipereira0123 13 днів тому
to whoever reached a point in life where you ended up here or doing this, i really hope you find inner peace one day...
@marcsfeh
@marcsfeh 14 днів тому
C's syntax makes things excessively hard to parse, in other languages like C3 or more Pascal style languages (like Go and Odin) it's much more clear how these declarations compose
@Apis035
@Apis035 14 днів тому
Odin makes me realize that C's syntax is absolute mess. Odin's syntax makes writing function pointer really easy to understand 👍
@user-sl6gn1ss8p
@user-sl6gn1ss8p 14 днів тому
It's a feature to sure you realize you're doing something bad : p
@Jutastre
@Jutastre 12 днів тому
I think the trick to parsing C declarations is to go from the inside (the name) out. Although you still have to know parser priority. Like the animation at 2:40, except it messes up the priority by looking at "int" before [20]
@Jutastre
@Jutastre 12 днів тому
The 4:40 example shows the inside out parsing even better. The 5:35 example seems more complicated because of the function signatures but those aren't as important to parse IME. You basically just copy that from the function in question. If you need to understand it better you just look at that function itself.
@user-sl6gn1ss8p
@user-sl6gn1ss8p 12 днів тому
@@Jutastre yeah, the parsing itself is pretty straightforward once you know how things associate and the relevant operator precedence. You start from the name and apply stuff to it from there - the result of doing this will generate something of the type on the left (the "return type" of the expression). Making sense of complicated definitions without naming the steps in the way is just hard by nature - C lets you expose yourself to that, but doesn't make you: you can always typedef things into reasonable steps if you'd like.
@norude
@norude 12 днів тому
I think, most of the confusion comes from the syntax. For example, int (*(*x)[])() in Rust, would be Box> "Box" is Rust's pointer i32 is Rust's int
@spacemario
@spacemario 12 днів тому
If I understood it correctly, that's a pointer to a vector of pointers to functions that return an int, right?
@norude
@norude 12 днів тому
yes, it's just a lot of angle brackets, in a way that actually makes sense C works the other way around
@shanesnover4048
@shanesnover4048 12 днів тому
Your outermost Box is unnecessary indirection as the Vec already places the memory on the heap.
@norude
@norude 12 днів тому
@@shanesnover4048 that's true, but not relevant
@jrstf
@jrstf 12 днів тому
Imagine programming in a language where you can actually specify the type of a value (i32) rather than some kind of a suggestion which varies in meaning in every implementation and even with platform specific switches on the command line.
@JoaoJGabriel
@JoaoJGabriel 6 днів тому
It all can get stupidly complicated as we've seen, but the syntax follows simple rules: 1. start reading from the identifier out 2. favor [ ] and ( ) over * For example, int (*(*x)[ ]) ( ): - Following rule #1, we start at x - The identifier x is alone in parentheses with \*, so it is 1* a pointer - Outside of the parentheses, we follow rule #2, so it is 2* an array - We're left with a * inside the parentheses, so 3* pointers - Outside of the parentheses, rule #2, 4* functions - The functions return 5* int putting 1*, 2*, 3*, 4* and 5* together: x is (1*) a pointer to (2*) an array of (3*) pointers to (4*) functions that return (5*) an integer Once you got the hang of it, you can rewrite the example like as: * [ ] * ( ) int And stitch things together in a way that makes sense (e.g. writing "a function that takes ..." before saying what is inside a parentheses, "and returns..." after a function and using plural after mentioning an array) Take the example of 5:34: [ ] * * (* char, * (* char) * int) [ ] * (* * char, * ( ) * char) * int It looks insane, but it's not that difficult to wrap your head around if you're writing it following those two simple rules
@norude
@norude 12 днів тому
I finally understood. The type signatures are provided not the obvious way around, but outside in. For example: int x() is a function named "x", returning an integer. But instead of "x", I can put something different and it will mean, put the whole function inside whatever is in that position. For example "int (*x)()" means to put the function inside the *x. So It's a pointer to a function. But it's not just functions, it's **everything** if we analyze the "int (*x)()" again we get: int , which means to put the integer inside something that something: () It's a function! which means, that we put our int iside the return paramater of that function what's something: * it's a pointer! which means, we put our whole function with integer return type into a pointer. that something: x It's a name "x" which means, we put our whole pointer to a function with a return type of integer into the name "x" Let's do another example: char *(*(*(**x[])())[])(); it's a char, which is in a pointer, which is in the return type of a function, which is in a pointer which is in an array which is in a pointer, which is in the return type of a function, which is in a pointer, which is in a pointer, which is in an array, which is in "x"
@sasho_b.
@sasho_b. 9 днів тому
Nah I mean if you understand it then great, but nah Its name first, then sufix left-to-right, then prefix right-to-left, with () being the sufix function arguments operator. I best understand it same as the compiler, start from the inside and go out, sufix prefix exit-braket. Its doesnt matter here, yes, but this also reminds you how other operators work like array access and dereference operators. *x[8] means "take the 8th member of x and dereference", where as (*x)[8] means "dereference x and take the 8th member of that"
@halflight8811
@halflight8811 14 днів тому
this is what I understood from 3:10 - arr[0] -> func1 => int1 - arr [1] -> func2 => int2 x ->arr - arr[2] -> func3 => int3 - arr[3] -> func4 => int4 - arr[4] -> func5 => int5
@GL0RYS
@GL0RYS 14 днів тому
bro lost me before the ad break 💀
@kingpen5866
@kingpen5866 12 днів тому
Bro really said bro 💀
@GL0RYS
@GL0RYS 12 днів тому
@@kingpen5866 bro really said bro cause i said bro 💀
@fodetraore6666
@fodetraore6666 12 днів тому
Bro realy saic bro to some bro who realy said bro to bro 's comment 💀​@@GL0RYS
@VictorMartinez-vi7jx
@VictorMartinez-vi7jx 9 днів тому
bro is a pointer to a bro that points to a bro
@GL0RYS
@GL0RYS 8 днів тому
@@VictorMartinez-vi7jx bros making sense 🙏
@jatinsharma3280
@jatinsharma3280 13 днів тому
Man, It felt awesome and confusing at the same time, but thanks to you I come to know the different use of pointers.
@aaravdayal4529
@aaravdayal4529 12 днів тому
This actually made me understand pointer expressions. Thank you.
@prism223
@prism223 13 днів тому
In older computers, especially Lisp machines, pointers always came with a size. A pointer was a 2-D object to the hardware. It had a location, and a size. The weirdness of C/C++ pointer types is an attempt to recapture some of the elegance of earlier hardware in a later era where the hardware forgot about data safety.
@zFede_Rico
@zFede_Rico 13 днів тому
0:14 as soon as i read "france" i subscribed and liked the video
@oyoplayer
@oyoplayer 6 днів тому
I love France
@mazyyyy
@mazyyyy 11 днів тому
I FINALLY GOT POINTERS after more than 15 tutorials and another 15 "explanation" videos, you somehow made my brain click. Thank you so much!
@tiaanbasson9092
@tiaanbasson9092 14 днів тому
That line of code in the thumbnail alone drove me insane and I haven't even watched the video yet.
@bubbleopter
@bubbleopter 10 днів тому
Such an awesome teaching style!
@user-hh8jh5gw8i
@user-hh8jh5gw8i 11 днів тому
Entertaining and very educational for me. Seeing different uses of pointers that you tried to demonstrate and describe them made my me intrigue, but at the same time dizzy. 😂
@sdwone
@sdwone 6 днів тому
Understanding pointers, is like the Great Barrier between amateur devs and the pros! Because THIS is a concept in which knowing how computers actually works, helps tremendously!
@Komil484
@Komil484 13 днів тому
The way i look at it is, the way you declare a pointer, is the way you access it. So if you got int *(*p[]), you'd access the innermost value (being the int) in the same way: *(*p[i]). And then you work your way backwards To make the point(er) clearer ill go through this. So you access the int by doing *(*p[]), so *p[] is an array of pointers to int, and *p points to an array of pointers to int, and p is a pointer to an array of pointers to int
@Diamondyoutubization
@Diamondyoutubization 13 днів тому
I think this video actually made these easier to parse.
@therealdia
@therealdia 12 днів тому
Ok how was this convoluted mess the thing that actually taught me how pointers work lol
@tvardero
@tvardero 11 днів тому
6:00 Bro is holding the entire class inside his variable definition The God Variable.
@NicolasChanCSY
@NicolasChanCSY 13 днів тому
A programmer goes to therapy. Therapist: Please tell me what you are scared of. Programmer: I am scared of pointers. Therapist: Okay, let me give you an array of pointers to handle them. Programmer: 😱😱😱
@xtremecoding4005
@xtremecoding4005 14 днів тому
This video made me cry
@codecat3406
@codecat3406 8 днів тому
The fact that C lets you write stuff like this makes me think that someone forgot to write it as an entry in the Geneva convention
@IuseArchbtw-di6cd
@IuseArchbtw-di6cd 7 днів тому
I mean C programmers are responsible for the crime of becoming the viction of backdoor and zero-day vulnerability
@josephmazor725
@josephmazor725 12 днів тому
Actually the best explanation of these bullshit functions I’ve seen, thanks!
@mvargasmoran
@mvargasmoran 12 днів тому
what I get from this is that the song at the end rocks.
@farukyldrm8498
@farukyldrm8498 12 днів тому
you shoud have mentioned operator precedence. and also thr syntax related to those concepts perfectly fit into english grammar. as a Türk, ı can say it in english (up to some point) but cannot think of its meaning because we build up the noun phrases other way around
@hodayfa000h
@hodayfa000h 13 днів тому
My favorite programming channel
@proteinsheikh9544
@proteinsheikh9544 13 днів тому
Absolute heater 🔥🔥🔥🔥
@DavidSchiess
@DavidSchiess 9 днів тому
Why: If you're a postman in a small town and they ask you to "deliver this package to that weird yellow house", you'll figure out where to deliver what in a reasonable amount of time. But if you need to deliver a massive amount of packages, that are all stored in different places inside a big warehouse, to a couple of skyscrapers with multiple delivery points per floor, you'll have a much easier time if the exact address is provided.
@lovalmidas
@lovalmidas 8 днів тому
On one hand, class/module structures and delegates are basically pointer stuff in pure C. In higher languages, these things 'look' much simpler, by simpler it means the context now spans several .cs files. :P On the other hand, your professor could give you a snippet of ASM code, and ask something like: provide an (or the most restrictive) equivalent C function signature of a CALL function in the code. Yes, you shall use "mov dh,word ptr [eax]" to figure out that eax is a pointer to the value dh now holds, and the only use case of the value being "test dh,dh" means eax can be a *byte, or *bool. :'D
@tosaksettharungson
@tosaksettharungson 4 дні тому
I buried this nightmare 20 yrs ago. After watching I'm sure I'll get one tonight.
@vesale.a7745
@vesale.a7745 10 днів тому
I seriously never could imagine insanity up to this level.
@ffreezed5620
@ffreezed5620 13 днів тому
ohhh, i get it, thx :D. Finally understand pointer in my 3rd year in uni :)
@iCrimzon
@iCrimzon 12 днів тому
"Go insane?" GO MENTIONED RAAAAAAAAAAAAAAAAAAAAAAAAA
@batatanna
@batatanna 12 днів тому
WE GOIN OUT OF THE HOOD WITH THIS ONE 🗣️🗣️🗣️🗣️🗣️
@Mellon00
@Mellon00 11 днів тому
I don't know how and I certainly don't know why, but I understood EVERYTHING this guy said, and now I somehow know how to use pointers, take this video to schools. This generation will know how the fuck pointer works, even if they don't know why they need to know that x is an array of pointers to pointers to functions that receive "a pointer to a character, and a pointer to a function that receives a pointer to a character and returns a pointer to an int" and returns a pointer to an array of pointers to functions that receive "a pointer to a pointer of characters, and a pointer to a function that returns a pointer to a character" as arguments and return a pointer to an integer
@landin1181
@landin1181 12 днів тому
Your memory view and c debugger in vscode look very nice. Could you do a video on how you set this up or just gimme some info lol im jealous.
@siddharthbhatia8815
@siddharthbhatia8815 9 днів тому
same
@semmu93
@semmu93 11 днів тому
also all this pointer magic can be neatly swept under the rug if you use a lot of typedefs with proper names, makes the code much easier to understand for everyone
@mikaelluca8827
@mikaelluca8827 11 днів тому
love the soundtrack
@yuritsukahara
@yuritsukahara 11 днів тому
awesome. dude I need your fonr and vscode thee right now
@theimmux3034
@theimmux3034 12 днів тому
"getting into programming is easy" the programming in question:
@anon_y_mousse
@anon_y_mousse 11 днів тому
If I caught someone on my team writing things that way I'd fire them. A semi-quote from Ian Malcolm is most apt here, just because you can, doesn't mean you should. One of the rules I have for any project I work on is to typedef all function pointers because no one should have to parse that crap when reading the code. It obscures what the code is really doing.
@danielrhouck
@danielrhouck День тому
Your first example should fail to compile (if you use -Werror), because control reaches the end of non-void function; the curly braces shoulsn’t be there. Also, although it is useful to be able to read the types like this, the real way to handle them is to use `typedef`s to name the intermediate types. 3:20 You’re mixing up your types. This is probably C pre-23 so it works but not well. You should say as part of the type that the pointers in the array that two `int` arguments.
@satoshikei
@satoshikei 11 днів тому
Pro Tip: Just add another */& or put around parentheses until you get no compilation errors.
@JLSXMK8
@JLSXMK8 13 днів тому
3:29 --> See line 15 (3:21) for further clarification. In short, line 25 is saying that you want to first dereference the pointer, followed by selecting the function at index 0 for that pointer; then you have to de-reference that index (the array itself decays to a pointer containing the addresses of each function) in order to call the function you want from that double pointer. i.e., createFunctionPointerArray() returns "& -> {&add, &subtract}". You're making an embedded function library, I guess you could say, that the variable references, and you have to dereference all those pointers to access the function you want. Easy to understand?
@drominitoketchup
@drominitoketchup 14 днів тому
Hi, you have been found in my recommendation :O I'm watching it only 0:32 and already subscribed you. You have a funny sense of Humor btw xD.
@drominitoketchup
@drominitoketchup 14 днів тому
I understood 80% after 15 min totally
@pierrotarat
@pierrotarat 12 днів тому
"Great, you've explained these quite well. Now use them."
@ThanhDanhNguyen-zr2je
@ThanhDanhNguyen-zr2je 6 днів тому
Those complex function declarations make me think of complex relational database.
@klevisimeri607
@klevisimeri607 13 днів тому
I like your vids a lot!
@VivekYadav-ds8oz
@VivekYadav-ds8oz 12 днів тому
I can't believe I actually was able to solve the last two after fumbling on all the previous ones (mainly because of parenthesis which changed if x was a pointer to an array or an array of pointers). I think I'm cursed now.
@sasho_b.
@sasho_b. 9 днів тому
Is that the all-too-common array of arrays length 8 of pointers to functions returning pointer to array of pointers to char? (The order is name, sufix, prefix, and operators on a name before sufix brackets (i.e. function argumrents) infer that the function is what is being stored in that way, after that is what is being returned; this necessitates that the type before the sufix brackets be a pointer as anything else C wouldnt know how to store) (Also the question would not parse, let alone make sense, you declare an array of arrays of undefined length, thats not allowed, if it was itd be an array of arrays of pointer pointers to functions returning a pointer to arrays len 8 with pointers to int) Or, in simple terms, its probably a number. Tldr just use c++, rust, java, python, ets. C is for pointer tricks and programming elevators, not for actual use. Unless you're making an OS, then it may come of use. C walked so that higher level languages could run.
@zxuiji
@zxuiji 11 днів тому
Here's a little tidbit for variable management, while GCC has it's cleanup attribute for a more generic solution that works without it (and a lot more flexibly too), here's my solution (copy pasting an entire header here): ```C #pragma once #include typedef unsigned long ulong; typedef unsigned int uint; typedef char const *str; typedef struct { size_t len; str txt; } strvec; #define bitsof(T) (sizeof(T) * CHAR_BIT) #define lengof(LIT) ((sizeof(LIT) / sizeof(LIT[0])) - 1) typedef struct expiry_link expire; typedef void (*expiryCB)( void *data ); struct expiry_link { void *data; expire *next, *prev; void (*expireCB)( void *ptr ); }; inline void expire_linked( expire *head ) { for ( expire *link = head->prev; link != head; link = link->prev ) link->expireCB( link->data ); } inline void expire_nothing( void *data ) { (void)data; } inline void insert_expirable( expire *head, expire *link ) { head->prev->next = link; link->prev = head->prev; head->prev = link; link->next = head; } inline void remove_expirable( expire *head, expire *link ) { link->prev->next = link->next; link->next->prev = link->prev; link->prev = NULL; link->next = NULL; } #define DECL_EXPIRY_HEAD() \ expire expiry_head = { NULL, &expiry_head, &expiry_head, expire_nothing } #define DECL_EXPIRABLE( NAME, FUNC ) \ expire expirable_##NAME = { (void*)&NAME, NULL, NULL, (expiryCB)FUNC } /* For libraries that have termination functions */ #define DECL_EXPIRYLIB( NAME, FUNC ) \ expire expirable_##NAME = { NULL, NULL, NULL, (expiryCB)FUNC } #define INSERT_EXPIRABLE(NAME) insert_expirable( &expiry_head, &expirable_##NAME ) #define REMOVE_EXPIRABLE(NAME) remove_expirable( &expiry_head, &expirable_##NAME ) #define EXPIRE_LINKED() expire_linked( &expiry_head ) #define EXTERN_EXPIRABLE_H_INLINES() \ extern inline void expire_linked( expire *head ); \ extern inline void expire_nothing( void *data ); \ extern inline void insert_expirable( expire *head, expire *link ); \ extern inline void remove_expirable( expire *head, expire *link ) ```
@madalenaferreira3018
@madalenaferreira3018 10 днів тому
somehow this made me understand pointers better than 4 years in uni
@glitchy_weasel
@glitchy_weasel 8 днів тому
Unirocanically very useful video. Mad respect at the dinosaurs who invented C lol
@ThousandsOfPk
@ThousandsOfPk 10 днів тому
Interfaces are a fine abstraction from function pointer madness
@joshuam2263
@joshuam2263 11 днів тому
I came into this, expecting to learn how to read that stuff. Sadly I don't think I learned anything (except maybe reading the decl from the inside outwards?). This video was entertaining though. Just to give you feedback
@maksymiliank5135
@maksymiliank5135 11 днів тому
A simple hack to read c types is to start from parenthesis and then read from right to left. So if you see something like int (*x)[4] its: *x - x is a pointer -------------------------^ [4] - to an array with length 4 -----------^ int - to an int ---------------------------^ Another example: int (*x)(char (*t)[4]) we start with parenthesis so x is a pointer then to the right we see another parenthesis so x it is a pointer to a function then we parse the arguments so the function takes a pointer t to an array of length 4 of chars an the original function x points to returns an int
@sasho_b.
@sasho_b. 9 днів тому
The t wouldnt parse i think, its just char(*)[4] its just the inner-most left-most bracket that is the inferred start, for function argument types So the argument int (*)() is a pointer to a function returning int with an empty argument list
@maksymiliank5135
@maksymiliank5135 6 днів тому
@@sasho_b. oh yeah. You cannot name the function parameters in the type delaration. Forgot about that
@craftydoeseverything9718
@craftydoeseverything9718 14 днів тому
How did you not go insane sooner?!!?!?!???
@JacksHQ
@JacksHQ 8 днів тому
You had me at "Fucker". Subscribed.
@Pryvyd9
@Pryvyd9 11 днів тому
This is cool but I like doing practical stuff with pointers. Like serializing objects as if they were binary arrays or creating smart pointers which delete themselves when nobody references them.
@Rose-ec6he
@Rose-ec6he 9 днів тому
I wish this was a joke of some kind, then I wouldn't want to cry
@s8x.
@s8x. 12 днів тому
bro got every meme in his vault
@thfsilvab
@thfsilvab 11 днів тому
Even the parser gave up, and he's still going
@nickpratt9338
@nickpratt9338 12 днів тому
Please do a vid of how you got that view of memory!
@pawan4920
@pawan4920 14 днів тому
How to open that memory view in vs
@n3bul0n
@n3bul0n 14 днів тому
Right click and select Disassembly View
@JerryThings
@JerryThings 8 днів тому
This video is amazing
@BazingOringore
@BazingOringore 13 днів тому
9 am in the morning..have homeoffice and a Coffee.. why i hurt myself with this video.😂❤
@psyk0oooo
@psyk0oooo 14 днів тому
i like your funny words magic man
@therelatableladka
@therelatableladka 12 днів тому
Everytime I paused and I am shocked how i get it before you start telling how to understand it. Maybe because i have been doing reverse engineering and malware stuff for long time now. Those codes actually have hell of typecasting with different data types and sizes. But greater video !!! ❤
@matheussilveriosilva5412
@matheussilveriosilva5412 12 днів тому
Hey man great video, but what is ypur extensions for memory looking and your theme
@ungenieur
@ungenieur 12 днів тому
i think i found it it's : mcu-debug.memory-view
@matheussilveriosilva5412
@matheussilveriosilva5412 12 днів тому
@@ungenieur oh thank you my friend
@pierregarric6674
@pierregarric6674 7 днів тому
To create a program that parses a C expression and translate it into a sentence would be quite fun to do
@hundvd_7
@hundvd_7 13 днів тому
3:00 Yeah, this is 100% the syntax's fault. This could be so much better. Even with TS, the language I currently work in, I could write it easier. And I _hate_ the syntax of typescript. I'm pretty sure it would just be this: x: Pointer[]> or with similar syntactic sugar, something like: x: **(() => int)[] instead of: int (*(*x)[])() The useless parentheses and the weird logical bubbling of the type definition is really fucking me up. Not even sure if I understand it right tbh
@Wazzup_Taibei
@Wazzup_Taibei 11 днів тому
interviewer: Great, add it to our interview question list!
@mintx1720
@mintx1720 11 днів тому
instruction unclear, rewrite in zig
@Herio7
@Herio7 День тому
The biggest problem with pointers is batshit insane C syntax.
@MadMetalMacho
@MadMetalMacho 11 днів тому
Small clarification: you're never pointing to an array, you're always pointing to the location where your array starts.
@Morgan_iv
@Morgan_iv 3 дні тому
At some POINT I've stopped perceive word "pointer" as some meaningful entity and instead started to interpret it as some weird IKEA furniture name
@SpencerYonce
@SpencerYonce 10 днів тому
That last example... something like this? using CharPtr = char*; using FunctionReturningIntPtr = int*(*)(CharPtr); using FunctionPointer = int*(*)(CharPtr*, FunctionReturningIntPtr); using ArrayOfFunctionPointers = FunctionPointer*; using xType = ArrayOfFunctionPointers*;
@ZenWith
@ZenWith 12 днів тому
explaining GO pointers till i GO insane
@VictorMartinez-vi7jx
@VictorMartinez-vi7jx 9 днів тому
I am subscribing without further questions
@jrstf
@jrstf 12 днів тому
First fix I would do to C is eliminate prototypes. Rather than writing a function prototype, just write the name of the [virtual] function the pointer references.
@freshtauwaka7958
@freshtauwaka7958 6 днів тому
Here is my trick: When you see "int * x" Don't think "x is an int*" Think "when you dereference x you get an int" Example for 2:49: int (*x())[20] x is something that when you call it then you dereference the result of that and then you subscript (look at an index), you get an int
@lollogeimer351
@lollogeimer351 День тому
And this is just the declaration, imagine using those pointer
@beqa2758
@beqa2758 3 дні тому
1:47 isnt that a bug? You should take &strings ?
@Powerm1nt.
@Powerm1nt. 12 днів тому
What font do you use ? that font is so cool !
@Yipper64
@Yipper64 14 днів тому
I knew that I found pointers confusing... I just didnt know quite how deep that went.
@nulldot0
@nulldot0 11 днів тому
Bro what's your vs code theme it looks nice
@Jonas-Seiler
@Jonas-Seiler 12 днів тому
and this shit is probably why we now have arrow syntax and first class functions instead
@AndersonPEM
@AndersonPEM 12 днів тому
I'm having PTSD from university every time you say pointers more than 2 times in a row
@Syndesi
@Syndesi 11 днів тому
I am glad that I use languages without pointers xD
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Переглядів 1,9 млн
I Got AI Interviewed AND BROKE IT
29:10
ThePrimeTime
Переглядів 177 тис.
Что будет с кроссовком?
00:35
Аришнев
Переглядів 2,2 млн
GADGETS VS HACKS || Random Useful Tools For your child #hacks #gadgets
00:35
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Переглядів 218 тис.
10 weird algorithms
9:06
Fireship
Переглядів 1 млн
Coding Interviews in 2024 Be Like
1:43
Mohin
Переглядів 17 тис.
The Bubble Sort Curve
19:18
Lines That Connect
Переглядів 292 тис.
9 Idiots Attempt to Make a "Game" in "48 hours"
7:34
Mults
Переглядів 216 тис.
Factorio teaches you software engineering, seriously.
21:27
Tony Zhu
Переглядів 1,1 млн
The purest coding style, where bugs are near impossible
10:25
Coderized
Переглядів 803 тис.
how NASA writes space-proof code
6:03
Low Level Learning
Переглядів 1,9 млн
The Future of Game Development
8:58
Brackeys
Переглядів 997 тис.
How I made a 3D Level in a 2D Game
24:28
Spu7Nix
Переглядів 1,1 млн
ЗАГОРЕЛСЯ пикап при ШИНОМОНТАЖЕ
0:29
ЛАЙФСТОРИ
Переглядів 6 млн
Гумор
0:10
такое
Переглядів 91 тис.