Is “able to find related code by searching keyword ‘MyClass ‘(variable declaration)” a reason to avoid using auto in c++?

According to https://softwareengineering.stackexchange.com/a/180616/432039 suggested, I know the answer advised “auto” should be used instead of the actual type when declaring variables.

However, the question is about the readability of code before and after using auto, but I found the biggest problem of “auto” is not the readability, instead “auto” hinders me to search the code that I need to fix by using keyword like ‘MyClass ‘ in variable declaration like “MyClass myclass = …”.

For example, suppose I have a c++ mobile game project that needs to load user settings using DTO “UserSettings”, and UserSettings may be loaded from game server, mobile device, or edit by user at some pages, eg (ignore .h and class definition for simpler code):

OldUserLoginPage.cpp

OldUserLoginPage::loadUserData(){
    //some code call http
    UserSettings userSettings=loadUserDataResponse.userSettings;
    //some other code
}

UserResumePage.cpp

UserResumePage::viewDidLoaded(){
    //some init code
    UserSettings userSettings=AppData::getUserSettings();
    //some other init code
}

SettingsPage.cpp

 SettingsPage::onLoadDefaultButtonPressed(){
    //some code
    UserSettings userSettings=DefaultUserSettings::getInstance();
    //some other code
}

When the game works fine over few months, suddenly a use reports that the user settings seems failed to save, and I’m quite sure I would forget about which .cpp contain UserSettings, and also I would forget about loadUserDataResponse.userSettings, AppData::getUserSettings() and DefaultUserSettings::getInstance(), except I know I can search for keyword “UserSettings ” to list all parts of codes that handle user settings.

However, if I just use “auto” instead of UserSettings, I can’t search for keyword “UserSettings ” to find which part of codes that use UserSettings. Although I may also able to find the related code by browsing each .cpp individually after using auto, search for keyword “UserSettings ” helps me a lot faster to find and fix the bug in the code. Also when a new teammate enters the team and start maintaining the code, the teammate may be unable to know which actual page refers to ???Page.cpp immediately, but the new teammate can search for keyword “UserSettings ” to find which part of the code in the project that may contain the bug.

Also even in a single .cpp, I find the type in variable declaration may also help me to find the related code quickly, for example, suppose there is a page about buying items and magic stones:

ShopPage.cpp

ShopPage::method1(){
   //some code
   this->updateTotalCost();
}

ShopPage::method2(){
   //some code
    this->updateTotalCost();
}
.
.
.
ShopPage::updateTotalCost(){
   //some other code
   double totalCost=item1.quanity*item1.price+item2.quanity*item2.price+...
}

Also after some day, suppose some users find the cost seems calculate wrongly, I forgot which function and variable name handles the cost calculating, except I remember the cost must be “double” type, then I can search for “double ” to jump to the related code to investigate the problem.

While I agree “auto” may help me to write the code faster, code is being read and maintained more often than being written, so I would rather write c++ as if “auto” never exists, so that I can search for the code by class/type declaration in order to find and fix the code quickly. So my question is, is the reason above the rationale to avoid using “auto”?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật