Hi,
I did not find any suitable questions answered yet, so I'd like to know what is "better" C++ style in the mean of performance and/or memory.
Both codes are inside a method. The question is: When to declare long prio
? And what are the implications?
Code 1
while (!myfile.eof())
{
getline(myfile, line);
long prio = strtol(line); // prio is declared here
// put prio in map...
// some other things
}
Code 2
long prio; // prio is declared here
while (!myfile.eof())
{
getline(myfile, line);
prio = strtol(line);
// put prio in map...
// some other things
}