Message from C, C++ talks

June 2019

— Dont learn rust

— But go's good

— Why Rust not?

— Because its another one of those modern languages that dont actually help too much?


I have 2 methods in my class;

std::string GetSessionHost() { return mSessionHost; }
const std::string& GetSessionHost() const { return mSessionHost; }

One of them returns a const reference to the member var, and another returns a copy of it. How can I be sure that my code calls the reference one when calling GetSessionHost ?

— The const one will be called if your class is const

— Dont use getters and setter tho

— Why not?

— Rust has a rigorous checking system to help coders advoiding errors

— My code always called the copying method, but when I removed the copying method and left only the reference method, it works now and calls it instead

Message permanent page

— But anyway life is too short ,no time to learn.

— What you gotta do is use your life to learn stuff

— Rigorous checking?

— If you want that, use cobol

— Nvm, my problem was simple; I cannot overload functions by return type :)