Vetting the cargo
Vetting the cargo
Posted Jun 13, 2022 14:28 UTC (Mon) by mathstuf (subscriber, #69389)In reply to: Vetting the cargo by adobriyan
Parent article: Vetting the cargo
> Funnily enough gcc 12 will optimise this exact code back to strlen():
FWIW, this can only be done because it assumes `s[len]` means `s != NULL` since such things would be UB (and can therefore be assumed to not happen). Otherwise, `strlen` adds the "must not be `NULL`" precondition and is not eligible for such optimization.
