Remove excessive .reserve calls, remove unexplained check#18630
Conversation
See comments on #18543 I don't see how we ever ran out of bounds there.
|
Regarding Resulting any attempt to use the [supposed to be] object in normal way (ie. assuming it's an object per documentation) could triggered an exception/crash. PS: i haven't tested the issue on linux build, in case it was a compiler bug that only occurred on windows. |
|
Huh, that is quite surprising! |
|
Well, that happens because you can't take a pointer to an empty (capacity) vector. It's kinda dangerous anyway. For begin, "If the container is empty, the returned iterator value shall not be dereferenced." Basically, you shouldn't use it. I don't see why null wouldn't be a valid return value in that case. It's really an implementation detail that -[Unknown] |
|
Yeah, indeed - reserve really doesn't mean you are allowed to call begin - that's a bug. still, surprising that the implementation is like that. |
|
Of course, Anyway, just now i tried to reproduce the issue by removing the |
I don't see a path where that check could reasonably be hit, so removing it until we figure it out, due to its perf critical location, as commented by Unknown.
Also, remove a bunch of excessive .reserve calls from #18557