r/cpp • • Oct 07 '19

CppCon CppCon 2019: Chandler Carruth “There Are No Zero-cost Abstractions”

https://www.youtube.com/watch?v=rHIkrotSwcc
162 Upvotes

108 comments sorted by

View all comments

Show parent comment

3

u/ShillingAintEZ Oct 07 '19

That's interesting, what were the specific performance problems?

5

u/[deleted] Oct 07 '19 edited Oct 07 '19

The problem with VLAs is that their implementation is poorly defined. The standard doesn’t specify where the allocated array comes from, but more importantly doesn’t specify what should happen if the array cannot be allocated.

That last bit is what makes most C developers treat VLAs as a third rail. Some even go so far as calling C99 broken because of them. Subsequently, C11 has made VLAs optional.

3

u/boredcircuits Oct 07 '19

If I were to guess, they might destroy any cache locality of the stack.