I am currently self-learning C/C++ though this question is not language specific. I couldn't find a similar question but I would like some good explanation with a focus on C/C++ design practices.
Is it a good coding practice to call a function with a return type from return()
? Is this something I should even be thinking of or is this a silly question to ask?
Consider the following -
bool A (blah, blah)
{
bool a = false;
a = B(); // B returns bool type
return a;
// OR
return (B());
}
Both compile and run obviously but is one better than the other in terms of some metric such as speed, memory efficient etc..? What could be the reasons to use one or the other or am I wasting my time by asking this question?
Aucun commentaire:
Enregistrer un commentaire