tags:

views:

69

answers:

2

Possible Duplicate:
What is the difference between _tmain() and main() in C++?

I found it in this post, but never see that before.

+2  A: 

The answer

Some other answer

EDIT: Right here on SO is another thorough description:

celavek
A: 

See http://msdn.microsoft.com/en-us/library/6wd819wh.aspx

_tmain resolves to main unless _UNICODE is defined. In that case, _tmain resolves to wmain.

Since all current Windows systems are Unicode-based, the "text" macros are largely obsolete. You should always define _UNICODE, and you can use wmain directly.

Philipp
Always use `wmain`? But this instantly makes your program non-portable even if you weren't using anything else non-standard.
Charles Bailey
Why character set can affect the entry point?
Alan
@Alan read the answer to the question this one duplicates; it's clearly explained there.
celavek
@Charles Bailey: The question is clearly related to Windows, and before the OP states his intention to port it to non-Windows OSes, I'd go for YAGNI. Using `wmain` allows your program to accept Unicode command line arguments with little effort, and that gain in functionality outweighs the theoretical portability issues. Of course, if you need to port the program, you have to use `main` at least conditionally.
Philipp