Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The Problem

Name: Fart Commander 2011-04-15 12:27

This is the prototype for the sprintf() function in MS Visual C.


#pragma warning(push)
#pragma warning(disable:4793)
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_ARGLIST(int, __RETURN_POLICY_SAME, _CRTIMP, sprintf, vsprintf, __out_z char, _Dest, __in_z __format_string const char *, _Format)
#pragma warning(pop)


If you ever catch yourself thinking "Hey, I could come up with a clever macro to do this repetitive work for me," you should ask yourself a couple of things before you start using it:
1) Does the macro improve readability?
2) Does the macro improve maintainability?

If the answer to either of those is "no," then just don't fucking do it.  No one is going to suck your dick for coming up with a macro that makes life difficult for everyone who uses your API.

Name: Anonymous 2011-04-15 21:01

>>1
What version is that? MS Visual C 6 only has
_CRTIMP int __cdecl sprintf(char *, const char *, ...);

>>16
I bet you think guns are the reason people get killed too (no, this is not going to become a discussion of werecows). Blame the incompetent programmers who shouldn't be writing code, not the tools.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List