Message from C, C++ talks

May 2019

— Yes, but not always

— Yes not always, like one we saw above

— Yea

— Right, but if you are doing something with a variable, does it really kill you to do something like

std::vector<int> modifiedVector = modifyVector(modifiedVector);


or is it better to do:

std::vector<int> x = func2(x);


Then have to comment what x and what func2 do?

Message permanent page

— 

This one doesn't even need a single comment to understand, but flooded with comments to make the copy paster understand what's going on

— Good for teaching

— Yeah thanks

— Conclusion,
Big and complex prg require comments

Simple prg doesn't....

— I'll rather add comments

— 1; true;

— Even if it takes 100 years and i come back to the code i'll understand what it means

— PIE

— U probably gonna die by that time🤣

— Apple pie or ?

— So you would rather add:

/*
this function modifies a vector by rotating the elements positions by 1
*/
void func2(std::vector<int> &x)


rather than actually state what the function does? That is bad coding practice. Naming is key to writing good, readable, code.

Message permanent page