Hard-coding

How do you define hard-coding?
Writing a program while turned on.
LOL
hehehe.
I get that.
closed account (S6k9GNh0)
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
cq's worked, but I expected more from the rest of you.
Your topic relevance got overridden by a good joke.
Besides, a good wikipedia link can answer *any* question. (In a manner of speaking)
I was going fo more a of a personal definition.
How about: something is hard-coded if you must re-compile to change its value.
closed account (S6k9GNh0)
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.
Configuration file?
closed account (S6k9GNh0)
Yeah but I don't want people changing the name of my program!
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
closed account (S6k9GNh0)
I do. You're still hardcoding the value of the constant though.
Last edited on
Yeah but it means you only have to replace the constant in one place: it's definition.
Topic archived. No new replies allowed.