I've been reading up on C and C++ lately and can't help shake the feeling that C/C++ programmers use abbreviation way to excessively in variable and function names. I can't see a reason why this would be beneficial, since both are compiled languages. Practically all code I've come across uses abbreviation more than in other languages (my personal experience, of course).
So the question then becomes this; is there a reason why you'd want to use abbreviations in C/C++? Are there performance issues with using longer variable names, or is it just a convention?
EDIT: Looks like I opened a can of worms here. I was hoping for a yes/no answer, not a discussion on coding style.
It's mainly a convention.
There was some historic need, since early C compilers didn't guarantee that identifiers were significant to more than 8 (or maybe even 6) characters in some cases (causing MyFantasticFoo
and MyFantasticBar
to be considered equal by the compiler). Modern compilers don't have such tight limitations, see this answer for details.
Today, I think it's more of a convention/style issue, that C code is often terse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With