Feb 9, 2010 at 6:01pm UTC
How do you define hard-coding?
Feb 9, 2010 at 9:26pm UTC
Writing a program while turned on.
Feb 9, 2010 at 11:37pm UTC
Coding something with something that doesn't have relevance to something else when it should.
void * pInt = malloc(4); //hard coded and possibly wrong
void * pInt = malloc(sizeof (int )); //not hard coded
Last edited on Feb 9, 2010 at 11:42pm UTC
Feb 10, 2010 at 12:07am UTC
cq's worked, but I expected more from the rest of you.
Feb 10, 2010 at 9:26pm UTC
Your topic relevance got overridden by a good joke.
Besides, a good wikipedia link can answer *any* question. (In a manner of speaking)
Feb 12, 2010 at 5:28pm UTC
I was going fo more a of a personal definition.
Feb 12, 2010 at 5:38pm UTC
How about: something is hard-coded if you must re-compile to change its value.
Feb 12, 2010 at 5:44pm UTC
I've always thought about that. I feel bad when I hard code the name of my window into the code although I know there's no way around it.
Feb 12, 2010 at 5:45pm UTC
Yeah but I don't want people changing the name of my program!
Feb 12, 2010 at 5:46pm UTC
Use a #define or a const std::string or something, then. It's a little less hard-codetastic.
Personally, when writing a program that is meant to be on the screen for more than a few seconds, I do as much as possible through a single configuration file called <program name>.conf.
Last edited on Feb 12, 2010 at 5:48pm UTC
Feb 12, 2010 at 5:47pm UTC
I do. You're still hardcoding the value of the constant though.
Last edited on Feb 12, 2010 at 5:47pm UTC
Feb 12, 2010 at 5:49pm UTC
Yeah but it means you only have to replace the constant in one place: it's definition.