{"id":6701,"date":"2012-12-17T15:12:03","date_gmt":"2012-12-17T20:12:03","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=6701"},"modified":"2014-07-14T10:11:04","modified_gmt":"2014-07-14T14:11:04","slug":"objective-c-pitfalls","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2012\/12\/17\/objective-c-pitfalls\/","title":{"rendered":"Objective-C Pitfalls"},"content":{"rendered":"<p><a href=\"http:\/\/www.mikeash.com\/pyblog\/friday-qa-2012-12-14-objective-c-pitfalls.html\">Mike Ash<\/a>:<\/p>\r\n<blockquote cite=\"http:\/\/www.mikeash.com\/pyblog\/friday-qa-2012-12-14-objective-c-pitfalls.html\"><p>The preprocessor splits macro arguments on commas. [&#8230;] These macros conceptually take a single argument, but they&rsquo;re declared to take variable arguments to avoid this problem. By taking <code>...<\/code> and using <code>__VA_ARGS__<\/code> to refer to &ldquo;the argument&rdquo;, multiple &ldquo;arguments&rdquo; with commas are reproduced in the macro&rsquo;s output. You can take the same approach to make your own macros safe from this problem, although it only works on the last argument of a multi-argument macro.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Mike Ash: The preprocessor splits macro arguments on commas. [&#8230;] These macros conceptually take a single argument, but they&rsquo;re declared to take variable arguments to avoid this problem. By taking ... and using __VA_ARGS__ to refer to &ldquo;the argument&rdquo;, multiple &ldquo;arguments&rdquo; with commas are reproduced in the macro&rsquo;s output. You can take the same approach [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,941,54,71],"class_list":["post-6701","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-macros","tag-objective-c","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=6701"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6701\/revisions"}],"predecessor-version":[{"id":9136,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6701\/revisions\/9136"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=6701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=6701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=6701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}