declares int tsize, sets it to GA_TARGET.size()
declares int spos (uninitialized)
declares int i1 (uninitialized)
declares int i2 (uninitialized)
not very readable
Typical showoff coding that costs support time.
Having a single line per declaration makes it more readable and does not add anything to the size/speed of the final product.
Typical showoff coding that costs support time.
Having a single line per declaration makes it more readable and does not add anything to the size/speed of the final product.
It is not show off code; rather it is a lazy style of init temp variables in a function. One could argue as to whether it is poor style or not. With regards to costing support time; one could argue it is a trade off between development time and support time![]()
If you are fluent in the language it adds nothing to the support though I suppose someone who is not familiar with the language might have problems with the expression.
There are all sorts of expression folks whine about such as:
i += 1;
i = i++;
i = ++i;
i = 1+ i;
i = i + 1;
of course none of the above are the same as
i -= i++
which is not the same as
i -= ++i
-
As to correct? Or costing support time ? Who knows; I suppose some formal study has been made somewhere but the sample population would have to be examined to determine bias.
Its not to surprising that c++ code gets written like this since it seems like the standard library functions were written at a time when keyboards wearing out from typing to much was a very real problem.![]()
strcpy...why isn't it just stringcopy? To easy and the plebs could understand that? Why not just write it in greek and be done with it?
Other possible explanations are that the keyboards in the 80s were made out of stone and pressing the heavy stone keys was labor intensive and exhausted programmers. Or perhaps the fact that the computer had only recently been invented meant everyone still used hunt and peck and less characters saved hours of time that would have otherwise been spent staring at the keyboard shouting "W! Where is the W?!"
int tsize = GA_TARGET.size(), spos, i1, i2;
int tsize;
int spos;
int i1;
int i2;
tsize = GA_TARGET.size();
Its not to surprising that c++ code gets written like this since it seems like the standard library functions were written at a time when keyboards wearing out from typing to much was a very real problem.![]()
strcpy...why isn't it just stringcopy? To easy and the plebs could understand that? Why not just write it in greek and be done with it?![]()
FORTRAN & COBOL have been around forever.:wub:Interesting. I'd noticed the same thing about Linux commands and wonder if there was some sort of connection. I figured there (used to be) a good reason, although I didn't know what it was. I have to remember C has been around forever and C++ carried its idiosyncrasies forward.
When I started C# I kept going "Damn, this is a lot easier to read. It just says what it does."