_tmain()是个宏?什么是宏,

zhang0804140227 2013-12-06 12:49:11
经常听到宏,但到底什么是宏,_tmain()是个宏?又是什么意思。。。请用通俗简洁的语言说明下,谢谢。。。
...全文
131 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
modyaj 2013-12-06
  • 打赏
  • 举报
回复
#define _tmain main
modyaj 2013-12-06
  • 打赏
  • 举报
回复
用A等价替换B
zbo_stepping 2013-12-06
  • 打赏
  • 举报
回复
引用 7 楼 mujiok2003 的回复:
http://stackoverflow.com/questions/895827/what-is-the-difference-between-tmain-and-main-in-c
受教 原来_tmain的_t和宏_T有点像 在unicode中翻译成wmain 在 多字节中翻译成main they've defined _tmain which, if Unicode is enabled, is compiled as wmain, and otherwise as main
mujiok2003 2013-12-06
  • 打赏
  • 举报
回复
http://stackoverflow.com/questions/895827/what-is-the-difference-between-tmain-and-main-in-c
modyaj 2013-12-06
  • 打赏
  • 举报
回复
引用 3 楼 u012982053 的回复:
[quote=引用 1 楼 modyaj 的回复:] 用A等价替换B
顶楼上的肺 每次看到绿豆蛙。 都忍不住啊 啊 啊 个人理解: 宏在编译时会被替换掉 或者是为了以词达意 方便修改#define WIDTH 100 或者为了方便书写 减少重复代码 typedef unsigned int (__stdcall *ThreadFunction)(void *pParam);就知道些简单的。。 复杂的不懂 mark 被宏搞得头大得很 好多不懂 学习[/quote] 别顶 会出血的。。。。。。 百度百科这么说: 什么是宏 计算机科学里的宏是一种抽象,它根据一系列预定义的规则替换一定的文本模式 我觉得就废话 知道定义没多大用处 简单的说 就是替换 这种做法不仅方便修改 书写阅读都方便 简单的宏函数还能提高程序的运行效率 ----------------------------------------------------------------------- 还是去查查宏的作用吧!
mujiok2003 2013-12-06
  • 打赏
  • 举报
回复
#ifdef _WINMAIN_
            /*
             * Skip past program name (first token in command line).
             * Check for and handle quoted program name.
             */
#ifdef WPRFLAG
            lpszCommandLine = (wchar_t *)_wcmdln;
#else  /* WPRFLAG */
            lpszCommandLine = (unsigned char *)_acmdln;
#endif  /* WPRFLAG */

            while (*lpszCommandLine > SPACECHAR ||
                   (*lpszCommandLine&&inDoubleQuote)) {
                /*
                 * Flip the count from 1 to 0 or 0 to 1 if current character
                 * is DOUBLEQUOTE
                 */
                if (*lpszCommandLine==DQUOTECHAR) inDoubleQuote=!inDoubleQuote;
#ifdef _MBCS
                if (_ismbblead(*lpszCommandLine)) {
                    if (lpszCommandLine) {
                        lpszCommandLine++;
                    }
                }
#endif  /* _MBCS */
                ++lpszCommandLine;
            }

            /*
             * Skip past any white space preceeding the second token.
             */
            while (*lpszCommandLine && (*lpszCommandLine <= SPACECHAR)) {
                lpszCommandLine++;
            }

#ifdef WPRFLAG
            mainret = wWinMain(
#else  /* WPRFLAG */
            mainret = WinMain(
#endif  /* WPRFLAG */
                       (HINSTANCE)&__ImageBase,
                       NULL,
                       lpszCommandLine,
                       showWindowMode
                      );
#else  /* _WINMAIN_ */

#ifdef WPRFLAG
            __winitenv = envp;
            mainret = wmain(argc, argv, envp);
#else  /* WPRFLAG */
            __initenv = envp;
            mainret = main(argc, argv, envp);
#endif  /* WPRFLAG */
赵4老师 2013-12-06
  • 打赏
  • 举报
回复
VS IDE中,在不明白的符号上点鼠标右键,选转到定义。
zbo_stepping 2013-12-06
  • 打赏
  • 举报
回复
引用 1 楼 modyaj 的回复:
用A等价替换B
顶楼上的肺 每次看到绿豆蛙。 都忍不住啊 啊 啊 个人理解: 宏在编译时会被替换掉 或者是为了以词达意 方便修改#define WIDTH 100 或者为了方便书写 减少重复代码 typedef unsigned int (__stdcall *ThreadFunction)(void *pParam);就知道些简单的。。 复杂的不懂 mark 被宏搞得头大得很 好多不懂 学习

64,676

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧