|
|
|
|
|
by mhogomchungu
3143 days ago
|
|
There could be an efficiency bug here. 1. "item->id()" is designed to return a pointer. 2. Consumer of the API writes their code to take a copy of the pointer and passes it along to "processSomeItem". It is cheap to make a copy of a pointer 3. The API is changed and it now returns a reference. 4. The assignment to "itemId" now makes an expensive copy of the object behind the reference causing inefficiency bug. 5. "processSomeItem()" API can handle the copy and the code compiles and runs without the problem being noticed. |
|