2009/6/24 Michael Stefaniuc mstefani@redhat.com:
Pierre Bourdon wrote:
I think what Michael meant is that sprintf(a, "%s", b);
is doing exactly the same thing as strcpy(a, b);
Right, that's what I meant.
in a less efficient way.
I'm not that much concerned about efficiency as the compiler will optimize it. But a strcpy is definitely easier to read.
I tend to assume that the compiler is an idiot that doesn't know a thing about optimisation, but that's me (e.g. using fputs for printing a string constant instead of fprintf). I find it makes for more readable/lean code.