{"id":1520,"date":"2012-10-27T12:10:42","date_gmt":"2012-10-27T17:10:42","guid":{"rendered":"http:\/\/bitpost.com\/news\/?p=1520"},"modified":"2012-12-02T10:27:24","modified_gmt":"2012-12-02T15:27:24","slug":"n-compilers-are-better-than-one","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2012\/n-compilers-are-better-than-one\/","title":{"rendered":"[n] compilers are better than one"},"content":{"rendered":"<p>I am loving cross-platform development with Qt, it&#8217;s robust and logical and leads to amazing native desktop apps.  Before getting started, I expected that there would be lots of platform-specific hackery required, and going cross-platform would slow down the end product by 20-30%.  But Qt is so reliable, and well-laid-out, and provides so much more than just lowest-common-denominator functionality, that I&#8217;m finding it to be much faster than, e.g., developing a desktop app with C# or Java.<\/p>\n<p>Another reason it is giving me leverage: [n] compilers are better than one.<!--more--><\/p>\n<p>I just hit a bug in Visual Studio with some STL code.  My comparison operator was throwing up because one of the objects in the array I was searching had bad data.  But you wouldn&#8217;t know it from Visual Studio, giving me an iterator error in their STL code, with no stack trace:<\/p>\n<pre><code>__thiscall _Lockit::~_Lockit()\r\n\t{\t\/\/ unlock the mutex\r\n\tif (_Locktype < MAX_LOCK)\r\n\t\t_Mtxunlock(&#038;mtx[_Locktype]); <- HERE\r\n\t}<\/code><\/pre>\n<p>I spent some time trying to isolate the upstream cause - I could have spent hours - until I had an inspiration: this kind of unhelpful compiler error information happens in just about every compiler I've used, about 5% of the time - but it happens in different ways in different compilers.  So I fired up the code in Qt Creator in OS X, and gcc showed me the error along with the line of code where the array search had begun.  Bingo.  Then I started looking through the values in the debugger, to find the bad data.  But again, I realized that Visual Studio has much better unwinding of debug variables in its debugger, so I looked up the line of code there, set a breakpoint, stepped over it and confirmed that was where I was getting the error - yep!  Then I could easily dig way down into my debug variables in style.<\/p>\n<p>Moral is: don't forget to take full advantage of each of your tools.  Save the headbanging for concerts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am loving cross-platform development with Qt, it&#8217;s robust and logical and leads to amazing native desktop apps. Before getting started, I expected that there would be lots of platform-specific hackery required, and going cross-platform would slow down the end product by 20-30%. But Qt is so reliable, and well-laid-out, and provides so much more [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[22,7,19,10],"tags":[170,119,172,28],"class_list":["post-1520","post","type-post","status-publish","format-standard","hentry","category-cpp","category-hangthedj","category-opensource","category-tricks-tips-tools","tag-c","tag-cross-platform","tag-java","tag-qt"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-ow","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=1520"}],"version-history":[{"count":5,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1520\/revisions"}],"predecessor-version":[{"id":1537,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1520\/revisions\/1537"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=1520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=1520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=1520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}