Why Function Pointers are Awesome

  Рет қаралды 5,165

Jacob Beningo

Jacob Beningo

Күн бұрын

In this 2022 Embedded Online Conference Microtalk, Jacob Beningo discusses the use cases for function pointers in embedded software.
This video looks at the C programming language function pointers, and how they can be leveraged for use cases such as:
- task scheduling
- command processing
- state machines
- interrupt vector tables
Developers often get confused that function pointers shouldn't be used in embedded systems because of MISRA C: 1998 Rule 104. As you'll see in this video, there are safe methods for using function pointers.
(The Embedded Online Conference will take place April 25 - 29th, 2022. If you are interested in participating, you can register with the code BENINGO to get at least a $100 discount).

Пікірлер: 21
@ralflici986
@ralflici986 5 күн бұрын
Very interesting talk, thank you!
@CuriousCyclist
@CuriousCyclist Жыл бұрын
Really good video! Thanks for taking the time to make it.
@LomasSubedi
@LomasSubedi 2 жыл бұрын
Thank you Jacob, your presence in here and on different blog article is helping so much to learn and understand.
@beningoembedded
@beningoembedded 2 жыл бұрын
Happy to hear that!
@grimvian
@grimvian 7 ай бұрын
The use cases gives me inspiration to enhance my C code, so a big thank you from me.
@btoven66
@btoven66 2 жыл бұрын
Great to see you again!!!
@beningoembedded
@beningoembedded 2 жыл бұрын
Thanks Peter! I'm planning to post a lot more this year so stay tuned!
@bahtiyar.bayram
@bahtiyar.bayram 2 жыл бұрын
Great content!
@Bob-zg2zf
@Bob-zg2zf Жыл бұрын
I just bought your book today.❤
@beningoembedded
@beningoembedded Жыл бұрын
Excellent! I hope you enjoy it!
@Bob-zg2zf
@Bob-zg2zf Жыл бұрын
@@beningoembedded I ordered it but I have not received it. I hope I will indeed enjoy it as much as I enjoyed your videos. The thing is, my expertise level is not that advanced. I am afraid I won't understand all or most of your book's contents. But I like your video contents and style and background.
@Bob-zg2zf
@Bob-zg2zf Жыл бұрын
@@beningoembedded Do you mind if I ask you a simple question? I have read your article, where you mentioned that we are supposed to "write rock-solid embedded software". But I can only design and solder an STM32 board with HCD1080, using someone's Keil project code that I downloaded from the Internet. So, how do I write my own entire project/code? How do I improve myself from using others' code to "write my own rock-solid embedded software"? The architecture seems so difficult to master to write from scratch or modify here and there....
@boudewijndijkstra82
@boudewijndijkstra82 Жыл бұрын
Another problem is that calculating the maximum stack usage becomes non-trivial. For each function pointer invocation it has to be clear which functions can potentially be called.
@beningoembedded
@beningoembedded Жыл бұрын
Absolutely! Thanks for the comment and observation!
@ThePing98
@ThePing98 2 жыл бұрын
Great video thank u
@beningoembedded
@beningoembedded 2 жыл бұрын
Glad you enjoyed it
@waynerifish
@waynerifish 2 жыл бұрын
Regarding "Make sure function pointers are NOT stored in RAM"... when I register a callback function, isn't that callback function pointer stored in RAM somewhere (e.g., UART0_ISR->function), even if it's done in pre-compiled or auto-generated code?
@shahfenil08
@shahfenil08 Жыл бұрын
Interestingly, I violated the rule that said it should be constant and my code was crashing because it was pointing to the 0x0. As I was debugging the issue, I found out another bug index out range. So one bug exposed another nasty bug. Note that, before implementing function pointer other bug was still there but I couldn't find out because my program haven't crashed or going into hard fault. :D
@deltakid0
@deltakid0 2 жыл бұрын
Could you please explain how the ATTiny85 bootloader works? It's a very basic MCU. Thank you.
@hsaidinsan6345
@hsaidinsan6345 2 жыл бұрын
Do they affect the real time performance?
@beningoembedded
@beningoembedded 2 жыл бұрын
Function pointers will not have a negative impact on the real-time performance. They can improve readability, scalability, and reusability though. They can also decrease maintenance too. If you were to look at what a function call really is, it's just a pointer to the functions code anyway!
Function Pointers | C Programming Tutorial
18:31
Portfolio Courses
Рет қаралды 57 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 6 МЛН
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 104 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 289 М.
Essentials: Pointer Power! - Computerphile
20:00
Computerphile
Рет қаралды 462 М.
Go Pointers: When & How To Use Them Efficiently
14:09
Anthony GG
Рет қаралды 70 М.
why do void* pointers even exist?
8:17
Low Level Learning
Рет қаралды 338 М.
you will never ask about pointer arithmetic after watching this video
8:01
Low Level Learning
Рет қаралды 235 М.
why are switch statements so HECKIN fast?
11:03
Low Level Learning
Рет қаралды 391 М.
Callback Functions in C Explained
13:26
Codeflash
Рет қаралды 49 М.
Weak Pointers in C++ (std::weak_ptr)
17:25
The Cherno
Рет қаралды 42 М.
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 905 М.
Как бесплатно замутить игровой ноутбук
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 238 М.
Самые крутые школьные гаджеты
0:49
АЙФОН 20 С ФУНКЦИЕЙ ВИДЕНИЯ ОГНЯ
0:59
КиноХост
Рет қаралды 1,1 МЛН