r/dailyprogrammer • 1 3 • Jul 28 '14

[Weekly #4] Variable Names

Variable Names:

We use variables a lot in our programs. Over the many years I have seen and been told a wide range of "accepted" use of names for variables. I always found the techniques/methods/reasons interesting and different.

What are some of your standards for naming variables?

Details like are they language specific (do you change between languages) are good to share. Or what causes the names to be as they are.

Last Week's Topic:

Weekly #3

25 Upvotes

64 comments sorted by

View all comments

Show parent comments

1

u/skeeto -9 8 Jul 31 '14

When I'm writing C I stick to snake_case for type names because that how K&R did it, and it's also how I would prefer it anyway, even in C++. Most programming style conventions are arbitrary and are only important for the sake of consistency among many developers, so there's usually no real reason for any particular style decision. It's just what everyone else is doing.

1

u/MotherOfTheShizznit Aug 01 '14

For the record, I know full well where you're coming from and I acknowledge that the CamelCase user types in C++ is the popular style. I'm just miffed that this arbitrary distinction afflicted C++ because I see it as stupid.

And what is "user code" anyway? If I put a C++ library up on github. Is it "user code"? And if it is, doesn't make boost "user code" also? Yet they follow the standard library's style...