Programming in Modern C with a Sneak Peek into C23 - Dawid Zalewski - ACCU 2023

preview_player
Показать описание

C Is Great, Long Live C! Programming in Modern C with a Sneak Peek into C23 - Dawid Zalewski - ACCU 2023

If you are a seasoned C++ programmer you might think about C as a prehistoric language stuck in the times of K&R. But have you ever heard about compound literals and about how they can be used to enable default function arguments in C? Or have you ever used flexible array members to simplify dynamic data structures creation? What about anonymous unions, designated initialisers or static array arguments? Never heard of those? C is a living language that has much to offer to those who care about performance, who program close to hardware or whose daily routine involves interfacing C++ with C code. If you are such a person, or you are just curious and would like to learn about the older, little brother of C++, this is a talk for you. We will (re-)discover the perks and perils of modern C. Step by step, we’ll see how leveraging the latest language features helps readability, improves safety and leads to better runtime performance. Who knows, maybe you’ll find writing C enjoyable (again)?
---

Dawid Zalewski

Dawid is a computer engineer with a heart for teaching. He's been programming for over 20 years evolving through Basic, Turbo Pascal and many other languages to finally find his home in the land of C++ (with occasional visits to Python). His interests focus on the design and evolution of programming languages and paradigms. In his free time he explores the forming landscape of data-driven education or reads books.
---

#accuconf #programming #cprogramming
Рекомендации по теме
Комментарии
Автор

As a C++ programmer I find myself moving more and more towards C for performance and simplicity. C is truly a legendary language.

zxcaaq
Автор

back in the day (late 80s in a university environment) a unix administrator and resident c guru warned me not to be fooled by the small size of the language since i could spend the rest of my life learning new tricks and exploring its possibilities.

dimitrioskalfakis
Автор

C is one rare language where you can do the same thing for 15 years and be called modern. And I like that.

henrikemppainen
Автор

I first learned C in 1984, shortly after working a long time in assembler. I could not believe that there was a high-level language that was so sloppy, did not check anything much, did not give any warnings, just let your mistakes causes crashes and even bring down the whole machine in those day.

Today I love C. It's minimal, the least "high-levelness" required to get one off assembler. It's small, one can can write a C compiler in reasonable time. It's best in class for performance.

Today I also love Rust. Finally a high level language that banished UB and checks almost all silly mistakes I might make. While maintaining the performance of C and avoiding the monstrous complexity and ugliness of C++. And it interoperates with C very well.

So I end up loving both C and Rust for polar opposite reasons. Rust will not replace C for me, they will coexist very well. I'm sure that is true in the wider world as well.

Heater-v..
Автор

25 year programmer here. I always knew C was a solid language, but I wasn't very productive in it. It gives you so much freedom, that without some knowledge of software design it can be difficult to build and maintain useful software. I learned so many languages over the 25 years, and it wasn't until I learned Golang and Rust that I actually understood how to design and build software correctly. When I came back to C, I had fresh eyes and I'm feeling like I can be productive in C. I'm still convinced C is the best programming language.

JayJay-kimi
Автор

C is like free will:
If you do good, you're the one to praise.
If you do bad, you're the one to blame.
C is the only one worthy of applause!

mhalton
Автор

Designated array initializers are amazing and have a use.

The trick here is that in the brackets you can use any constexpr expression, like enum values.
So you can have a map from enum values to whatever you want.

torsten_dev
Автор

This has been very interesting to watch.

Thank you, Dawid Zalewski, for taking your time to make this presentation.

GegoXaren
Автор

Thank you very much for mentioning MISRA.

I've been programming C (medical devices, automotive, telecom) since working at Bell Labs in the 1970s, love it, but your methodology, coding standards, and process determines the literal safety of the outcome.

stevejohnson
Автор

I write in C++ over 5 years, but nothing came close to C even now. Its a legendary language.

KennyTutorials
Автор

c doesn't totally lack type safety. C just has this feature called 'manual polymorphism' :)

homelessrobot
Автор

What a fantastic talk. As someone who hasn't spent much time with C since college, this was very informative and entertaining.

Delease
Автор

C has changed so much since I learned it in 86. C has barely changed since I learned it in 86!

RyJones
Автор

There is a lot that has been presented I already use regularly in my personal projects, especially for clearer initialization;

my priority is always about how to make the code more understandable, discoverable and debuggable though:

so many creative uses of macros, old and new, are banned from my code.

YellowCable
Автор

Ooooh! I use designated initializers for arrays all the time for a couple of things:
1) I often make static tables of data that are indexed by enum values. You just [MY_ENUM_INDEX] = {.the = data, .for = it}
2) Graphics code often uses integers for binding slots, so I initialize plenty of complex nested structures such as:
.targets[3].blending_mode = BLEND_ADD
or something like that where different shaders need to set data to certain indexes deep within a large, mostly empty structure. Designated init works *great* for this!

slembcke
Автор

You know there’s a problem when the format for your talk about why C is great is a quiz on how confusing C semantics are.

alexoverstreet
Автор

I had to wait 6 months to find this??? I'VE BEEN INITIALIZING STUFF WRONG FOR 6 MONTHS NOW!?!??! The shame, oh the shame!!!

ghlvubj
Автор

28:15 mapping enums on values for example

Автор

Long live C.... the grandfather of all programming languages!

chalimsupa
Автор

very good video, and the speaker was amazing :D

FaustoSaporito