﻿<?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>C++博客-sdlc86</title><link>http://www.cppblog.com/sdlc86/</link><description /><language>zh-cn</language><lastBuildDate>Fri, 10 Apr 2026 08:32:44 GMT</lastBuildDate><pubDate>Fri, 10 Apr 2026 08:32:44 GMT</pubDate><ttl>60</ttl><item><title>visual studio manual debug set</title><link>http://www.cppblog.com/sdlc86/archive/2014/10/16/208593.html</link><dc:creator>耳东晨</dc:creator><author>耳东晨</author><pubDate>Thu, 16 Oct 2014 07:50:00 GMT</pubDate><guid>http://www.cppblog.com/sdlc86/archive/2014/10/16/208593.html</guid><wfw:comment>http://www.cppblog.com/sdlc86/comments/208593.html</wfw:comment><comments>http://www.cppblog.com/sdlc86/archive/2014/10/16/208593.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sdlc86/comments/commentRss/208593.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sdlc86/services/trackbacks/208593.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">To enable debugging:</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">1) Goto Project-&gt;HelloWorld Properties</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">2) On the left expand "Configuration Properties"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">3) Expand "C/C++"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">4) On the left, Select "General"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">5) On the right, change "Debug Information Format" to "Program Database For Edit And Continue (/ZI)"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">5) On the left, Select "Optimization"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">6) On the right, change "Optimization" to "Disabled (/Od)"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">7) On the left, expand "Linker"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">8) On the left, select "Debugging"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">9) On the right, change "Generate Debug Info" to "Yes"</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">10) Click ok</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">11) Set your breakpoints</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">12) Rebuild your application</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 17.8048000335693px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">Also when running your application use Ctrl+F5 to build and run it, this keeps the console window open long enough for you to see your output.</p><img src ="http://www.cppblog.com/sdlc86/aggbug/208593.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sdlc86/" target="_blank">耳东晨</a> 2014-10-16 15:50 <a href="http://www.cppblog.com/sdlc86/archive/2014/10/16/208593.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>offsetof宏</title><link>http://www.cppblog.com/sdlc86/archive/2014/08/15/208023.html</link><dc:creator>耳东晨</dc:creator><author>耳东晨</author><pubDate>Fri, 15 Aug 2014 03:57:00 GMT</pubDate><guid>http://www.cppblog.com/sdlc86/archive/2014/08/15/208023.html</guid><wfw:comment>http://www.cppblog.com/sdlc86/comments/208023.html</wfw:comment><comments>http://www.cppblog.com/sdlc86/archive/2014/08/15/208023.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sdlc86/comments/commentRss/208023.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sdlc86/services/trackbacks/208023.html</trackback:ping><description><![CDATA[最近读libuv源码，看到了ngx_queue_t,里边用到了offsetof，第一次看到，网上查了一下，原来是获取struct成员内存地址相对于struct地址的偏移量，今儿想到了怎么实现的呢。<br />struct A {<br />&nbsp; &nbsp;int i;<br />&nbsp; &nbsp;char c;<br />&nbsp; &nbsp;float f;<br />};<br /><br />A* a = (A*)0;<br />size_t offset = (size_t)&amp;(a-&gt;c);<br />printf("%lu\n", offset);<br /><br /><br /><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;">#define offsetof(TYPE, MEMBER) ((size_t) &amp; ((TYPE *)0)-&gt;MEMBER )&nbsp;<br /><br /></span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;">一共4步&nbsp;</span><br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;" /><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;">1. ( (TYPE *)0 ) 将零转型为TYPE类型指针;&nbsp;</span><br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;" /><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;">2. ((TYPE *)0)-&gt;MEMBER 访问结构中的数据成员;&nbsp;</span><br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;" /><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;">3. &amp;( ( (TYPE *)0 )-&gt;MEMBER )取出数据成员的地址;&nbsp;</span><br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;" /><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;">4.(size_t)(&amp;(((TYPE*)0)-&gt;MEMBER))结果转换类型.巧妙之处在于将0转换成(TYPE*)，结构以内存空间首地址0作为起始地址，则成员地址自然为偏移地址；&nbsp;</span><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: #e8e8e8;"></span><img src ="http://www.cppblog.com/sdlc86/aggbug/208023.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sdlc86/" target="_blank">耳东晨</a> 2014-08-15 11:57 <a href="http://www.cppblog.com/sdlc86/archive/2014/08/15/208023.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>gyp</title><link>http://www.cppblog.com/sdlc86/archive/2014/08/14/208004.html</link><dc:creator>耳东晨</dc:creator><author>耳东晨</author><pubDate>Thu, 14 Aug 2014 02:21:00 GMT</pubDate><guid>http://www.cppblog.com/sdlc86/archive/2014/08/14/208004.html</guid><wfw:comment>http://www.cppblog.com/sdlc86/comments/208004.html</wfw:comment><comments>http://www.cppblog.com/sdlc86/archive/2014/08/14/208004.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sdlc86/comments/commentRss/208004.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sdlc86/services/trackbacks/208004.html</trackback:ping><description><![CDATA[首先，我们要先安装gyp<br /><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.600000381469727px;"><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">git clone https://chromium.googlesource.com/external/gyp.git <br />cd gyp <br />sudo python setup.py install<br />这个是make file<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">gyp mylib.gyp --depth=. -f make --generator-output=./build/makefiles<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">make -C ./build/makefiles/<br />这个是scons<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">gyp mylib.gyp --depth=. -f scons --generator-output=./build/sconsfiles<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">scons -C ./build/sconsfiles/<br />这个是xcode<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">gyp mylib.gyp --depth=. -f xcode --generator-output=./build/xcodefiles<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">xcodebuild -project ./build/xcodefiles/mylib.xcodeproj<br />这个是ninja<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">gyp mylib.gyp --depth=. -f ninja<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">ninja -v -C out/Release/ -f build.ninja<br />这个是vs<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">python gyp/gyp mylib.gyp --depth=. -f msvs -G msvs_version=2010<br /></span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;">msbuild mylib.sln<br /><br />gyp脚本编写，接下来再写。</span></p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.600000381469727px;"><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;"><br /><br /></span></p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.600000381469727px;"><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; font-size: 14px;"><br /><br /><br /><br /><br /></span></p><img src ="http://www.cppblog.com/sdlc86/aggbug/208004.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sdlc86/" target="_blank">耳东晨</a> 2014-08-14 10:21 <a href="http://www.cppblog.com/sdlc86/archive/2014/08/14/208004.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>