A Safer Iteration Model for C++ - Tristan Brindle - C++ on Sea 2023
---
A Safer Iteration Model for C - Tristan Brindle - C on Sea 2023
“Safety” is the word on everyone’s lips at the moment. Unfortunately for C programmers, one of our most fundamental abstractions — iterators — are fraught with danger . Prone to out-of-bounds memory accesses, unexpected invalidation and dangling, iterators are a UB minefield in which even experts can find themselves in trouble.
Fortunately there is something we can do about it.
In this talk we’ll look at an alternative, safer abstraction for iterating over sequences and introduce Flux, a new C 20 library implementing these ideas. We’ll see how Flux retains all of the power and flexibility of the existing STL, but greatly reduces the potential for UB through careful design and implementation choices — all while offering compatibility with existing code.
We’ll also take a look at performance and examine the cost of universal bounds checking. Spoiler: it’s probably a lot less than you’d think. In fact, we’ll see how Flux code can actually outperform equivalent C 20 Ranges code in some common situations.
Finally, we’ll take a quick look at some other quality-of-life improvements that Flux brings.
If you’re interested in the STL and the ranges and algorithms in C 20 and are looking for an easy-to-use way of making your codebase more resilient, then this is the talk for you.
---
Slides:
Sponsored by think-cell:
---
Tristan Brindle
Tristan Brindle is a C consultant and trainer based in London. With over 15 years C experience, he started his career working in high-performance computing in the oil industry in Australia before returning home to his native UK in 2018. He is an active member of the ISO C Standards Committee (WG21) and the BSI C Panel. He is a regular speaker at C conferences around the world, and is a director of C London Uni, a non-profit organisation offering free introductory programming classes in London and online.
---
C on Sea is an annual C and coding conference, in Folkestone, in the UK.
- Annual C on Sea, C conference:
- 2023 Program:
- Twitter:
---
YouTube Videos Filmed, Edited & Optimised by Digital Medium:
#cpp #cpponsea #programming
2 views
220
52
1 week ago 00:02:36 1
Five Little Elves | Christmas Song For Kids | Super Simple Songs
1 week ago 00:03:02 1
Milk & Cookies | Holiday Song for Kids | Rhymington Square
1 week ago 00:02:36 5
Jingle Bells | Christmas Song | Super Simple Songs
1 month ago 00:01:41 2
Trick Or Treat | Give Me Something Good To Eat | Halloween Song | Super Simple Songs
1 month ago 00:02:06 1
2025 ALL NEW KTM 1390 SUPER ADVENTURE S EVO INTRODUCED!!
1 month ago 00:05:26 1
Judo foot sweeps are NOT SAFE (real life examples)
1 month ago 00:02:42 1
Do You Like Lasagna Milkshakes? | Ice Cream and Lasagna!? | Super Simple Songs
1 month ago 00:02:42 1
Do You Like Pickle Pudding? | Kids Food Song | Super Simple Songs
1 month ago 00:02:43 1
Do You Like Broccoli Ice Cream? | Food Song for Kids! | Super Simple Songs
1 month ago 00:02:32 1
Do You Like Spaghetti Yogurt? | Super Simple Songs
1 month ago 00:05:00 1
Knock Knock, Trick Or Treat? | Halloween Song | Super Simple Songs
1 month ago 00:01:28 3
A-I Review Chant (Uppercase) | Super Simple ABCs
1 month ago 00:01:28 1
A-I Review Chant (Lowercase) | Super Simple ABCs
1 month ago 00:02:19 1
Child in Gaza talks about his cat being frightened by war
1 month ago 00:24:26 1
Tragic! 35 Shocking Car Crashes And Idiots in Cars You Wouldn’t Believe If Not Filmed!
1 month ago 00:29:35 1
FunOS | A Balance of Features and Functionality With Low-resource Usage
1 month ago 00:02:11 2
Five Little Ghosts | Halloween Song for Kids | Super Simple Songs
1 month ago 00:02:01 4
The Skeleton Dance | Halloween Song for Kids | Super Simple Songs
1 month ago 00:02:42 2
Hello, Trick Or Treat? | Halloween Song for Kids | Super Simple Songs
1 month ago 01:50:08 1
GODDESS OF VICTORY: NIKKE | 2nd Anniversary Livestream
1 month ago 00:01:24 1
Hello, My Friends | Trick-Or-Treating Song | Super Simple Songs
1 month ago 00:02:18 1
Who Took The Candy? | Halloween Song for Kids | Super Simple Songs
1 month ago 00:04:12 1
29,000 Feet Up Mount Everest with DJI Mavic 3 Pro
1 month ago 00:38:10 7
Fierce and Fearless: Alexandra Kiroi-Bogatyreva on Battling Corruption and Chasing Olympic Gold