﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-小卜空间</title><link>http://www.cnitblog.com/hardcorn/</link><description>大家好：）
欢迎大家来我这聊聊天，聊聊技术。也希望能通过这种形式交一些业内业外的朋友...</description><language>zh-cn</language><lastBuildDate>Tue, 05 May 2026 04:29:21 GMT</lastBuildDate><pubDate>Tue, 05 May 2026 04:29:21 GMT</pubDate><ttl>60</ttl><item><title>MFC中：UNUSED_ALWAYS宏的作用.</title><link>http://www.cnitblog.com/hardcorn/archive/2006/03/07/7309.html</link><dc:creator>hardcorn</dc:creator><author>hardcorn</author><pubDate>Tue, 07 Mar 2006 02:05:00 GMT</pubDate><guid>http://www.cnitblog.com/hardcorn/archive/2006/03/07/7309.html</guid><wfw:comment>http://www.cnitblog.com/hardcorn/comments/7309.html</wfw:comment><comments>http://www.cnitblog.com/hardcorn/archive/2006/03/07/7309.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/hardcorn/comments/commentRss/7309.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/hardcorn/services/trackbacks/7309.html</trackback:ping><description><![CDATA[这个宏定义在MFC的AFX.H这个头文件中。<BR><BR>#ifdef _DEBUG<BR>#define UNUSED(x)<BR>#else<BR>#define UNUSED(x) x<BR>#endif<BR>#define UNUSED_ALWAYS(x)&nbsp; x<BR><BR><BR>我在网上查了一下，了解到，它是用来处理函数中无用的参数的。<BR>看了它的定义，我们也可以了解了，它什么功能都没有，只是起到一个标记作用！<BR><BR>下边是个例子：<BR>MFC<SPAN class=small> 程序中不用的参数可以：<BR></SPAN><SPAN class=small>用宏： <SPAN style="FONT-WEIGHT: bold">UNUSED_ALWAYS</SPAN>（x） x</SPAN><BR><SPAN class=small>int CALLBACK EnumFontFamProc(ENUMLOGFONT FAR *lpelf,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NEWTEXTMETRIC FAR *lpntm,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int FontType,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LPARAM lParam)<BR>{<BR>&nbsp;&nbsp;&nbsp; <SPAN style="FONT-WEIGHT: bold">UNUSED_ALWAYS</SPAN>(lpelf);<BR>&nbsp;&nbsp;&nbsp; <SPAN style="FONT-WEIGHT: bold">UNUSED_ALWAYS</SPAN>(lpntm);<BR>&nbsp;&nbsp;&nbsp; <SPAN style="FONT-WEIGHT: bold">UNUSED_ALWAYS</SPAN>(FontType);<BR>&nbsp;&nbsp;&nbsp; <SPAN style="FONT-WEIGHT: bold">UNUSED_ALWAYS</SPAN>(lParam);<BR><BR>&nbsp;&nbsp;&nbsp; return 0;<BR>}</SPAN><BR><BR><img src ="http://www.cnitblog.com/hardcorn/aggbug/7309.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/hardcorn/" target="_blank">hardcorn</a> 2006-03-07 10:05 <a href="http://www.cnitblog.com/hardcorn/archive/2006/03/07/7309.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>