MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/35pn6h/criticizing_the_rust_language_and_why_cc_will/cr7ug89
r/cpp • u/afiskon • May 12 '15
61 comments sorted by
View all comments
Show parent comments
1
Result<T, Err> is only the size of the larger variant + 1, not their sum.
Result<T, Err>
This is incorrect; due to padding it most likely going to be more than just + 1, e.g. the size of Result< u64, u8 > is 16, not 9.
Result< u64, u8 >
I do wonder if there is any point in actually having this padded; it can waste a lot of memory (and trash the cache) while supposedly there is no performance hit on modern hardware for unaligned memory accesses.
1 u/Rusky May 13 '15 Sure, but it's not T+Err either, which was my main point.
Sure, but it's not T+Err either, which was my main point.
1
u/kouteiheika May 13 '15 edited May 13 '15
This is incorrect; due to padding it most likely going to be more than just + 1, e.g. the size of
Result< u64, u8 >is 16, not 9.I do wonder if there is any point in actually having this padded; it can waste a lot of memory (and trash the cache) while supposedly there is no performance hit on modern hardware for unaligned memory accesses.