Standard Abbreviations - clock_t?

Oct 16, 2016 at 7:35pm
Hey guys,

I want my code to be easily readable by all who needs to read it. Therefore, I want to stick with standard abbreviations through out my code. For example:

char chPlayerGender;
float fPlayerReflex;
class clPlayer {};
clPlayer *ptrPlayer;
int iPlayerStrangth;
string strPlayerName;

But What about a standard abbreviation for clock_t? is it just (t):

clock_t tPlayerRunSpeed;

Thank you in advance
Oct 16, 2016 at 7:46pm
Hello. You seem to have picked up a kind of bastardised Hungarian notation.

It's a standard, but it's not common or widely used. Many programmers will not find it helpful, not least because they don't use it. Far more useful is simply meaningfully named variables.
Last edited on Oct 16, 2016 at 7:49pm
Oct 16, 2016 at 7:48pm
oh?

What would you recommend?
Oct 16, 2016 at 7:50pm
Just meaningful variable and class names, written into code that's clear and concise.
Oct 16, 2016 at 7:54pm
Simple enough, Thank you, I'll just go with 't'
Oct 16, 2016 at 8:10pm
If I saw a variable named tPlayerRunSpeed and I knew you liked to use "t" to mean an object of type clock_t, I'd be very confused. So this is a clock_t object, right, so it represents a time, but the name suggests it's a kind of speed? So which is it, a speed or a time?
Oct 16, 2016 at 8:16pm
closed account (E0p9LyTq)
Making Wrong Code Look Wrong
http://www.joelonsoftware.com/articles/Wrong.html

Hungarian notation on steroids: semantic types & suffixes
http://fplanque.net/Blog/devblog/2005/05/11/hungarian_notation_on_steroids
Oct 16, 2016 at 10:37pm
I was just picking things that sounded about right. I'm only recently learning to use clock_t. What it really is:

clock_t tPlayerAttackSpeed;// how fast you can hit. Smaller the number, faster your attack rate
tPlayerAttackSpeed = 750; // Player can attack every 3/4ths of a second.
Last edited on Oct 16, 2016 at 10:48pm
Oct 17, 2016 at 10:07am
What you're calling "speed" is the inverse of speed. In this case, commonly referred to as the "period".

clock_t tPlayerAttackDelay; // the period of time between player attacks. Smaller time means more frequent attacks
Last edited on Oct 17, 2016 at 10:07am
Topic archived. No new replies allowed.