My IDE constantly says me to do this. I vaguely remember I've read in some C++ paper that has something to do with exceptions in constructors.
Java example:
void foo(){
String result = "";
int i = 5; // should this ever be a problem ?
}
For both lines IDE suggests to separate.
Additional questions
1. is there difference if I create by value or by reference.
E.g. in C++ class A{}; ... A a = ...;
vs A* a = new...;
2. my guess it's never a problem with basic types such as int
or float
. Are POD's the same ?