Embedded C Programming Style: Tutorial 11 - X Macro

preview_player
Показать описание
This tutorial details how to use X-Macro for automating code expansion.

0:00 Intro
0:15 Meaning and advantage
1:23 Normal code example
14:45 XMacro example
Рекомендации по теме
Комментарии
Автор

One of our programmers used X macros. I had a very hard time following his code. This video will help a lot !
Thanks ! 😁😀

kiq
Автор

After see the video twice, i can full get a grasp of this hidden topic is the first time that i hear about it..., thank you very much for sharing your knowledge, all these video series highly contribute to improve my c programming skills.

psykjavier
Автор

very informative. First time I heard about X Macro.

brijeshkhokhar
Автор

This is AWESOME! Macros are less readable but can really simplify a life.

MrHause
Автор

Hello sir please explain about bit byte access using struct and union for defining flag and user defined buffer size. Thank you so much...

ggtechnocracy
Автор

I tried to implement this but I got errors. I got error undefined reference to "set" and "get" functions. What is strange I cannot expand macro DATABASE_LIST in DATABASE_DATA section like you. Can it be cause by compiler type? I tried cross gcc and MigGW gcc project type. Another problem was that I could not leave empty enum..

MrHause
Автор

I am sure the actual concept behind the xmacro is not hard at all. But there's simply too much syntax to put up with. What defeats students is not the way xmacro works, it's the overwhelming strange syntax; which is a shortcoming of the language, I am sure it could've been made simpler and save the unnecessary complications.

LL-ueek
Автор

I support calling them list macros. X macros is a worthless term.

I use list macros extensively in my firmware development. The reason why they are so suitable for firmware specifically is that hardware features are accessed through memory mapped hardware registers. They cannot change at runtime. While many hardware features include runtime state, the vast majority of configuration happens once at startup, so there is every reason to generate these configuration data structures at compile time as const, placing them entirely in flash. There is no benefit to creating these structures in RAM at runtime. List macros, being a preprocessor function, are very well suited to creating data structures that are defined at compile time, rather than instantiated at runtime.

I can tell you that this video barely scratches the surface of what list macros can do. In fact, I've built a firmware application framework from the ground up based on them.

johnheaney
Автор

gcc -E database.c this command and see the result

sputniksputnik
welcome to shbcf.ru