<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: My current Prefix.pch file</title>
	<atom:link href="http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/</link>
	<description>Taglines are for Windows programmers</description>
	<lastBuildDate>Mon, 05 Dec 2011 10:55:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: From sqlite to core data &#124; How to&#039;s blog</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1580</link>
		<dc:creator>From sqlite to core data &#124; How to&#039;s blog</dc:creator>
		<pubDate>Mon, 21 Mar 2011 10:54:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1580</guid>
		<description>&lt;p&gt;[...] Some prerequisites - whatever sqlite addon you use for your projects, the method expects an NSDictionary with keys (sqlite column names) and the corresponding values. - I use ZAssert from Marcus S. Zarra (www.cimgf.com) [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Some prerequisites &#8211; whatever sqlite addon you use for your projects, the method expects an NSDictionary with keys (sqlite column names) and the corresponding values. &#8211; I use ZAssert from Marcus S. Zarra (www.cimgf.com) [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: iOS Development Link Roundup: Part 1 &#124; iOS/Web Developer&#039;s Life in Beta</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1515</link>
		<dc:creator>iOS Development Link Roundup: Part 1 &#124; iOS/Web Developer&#039;s Life in Beta</dc:creator>
		<pubDate>Thu, 25 Nov 2010 22:23:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1515</guid>
		<description>&lt;p&gt;[...] Prefix.pch macros to replace NSLog and NSAssert These macros are convenient drop-in replacements that allow you to have more control over logging and assertions. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Prefix.pch macros to replace NSLog and NSAssert These macros are convenient drop-in replacements that allow you to have more control over logging and assertions. [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2010-11-14 at adam hoyle presents suckmypixel</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1507</link>
		<dc:creator>links for 2010-11-14 at adam hoyle presents suckmypixel</dc:creator>
		<pubDate>Sun, 14 Nov 2010 12:20:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1507</guid>
		<description>&lt;p&gt;[...] Cocoa Is My Girlfriend » My current Prefix.pch file Suggested DLog and ALog macros for iOS/XCode development (tags: cocoa xcode objective-c iphone development programming debugging) [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Cocoa Is My Girlfriend » My current Prefix.pch file Suggested DLog and ALog macros for iOS/XCode development (tags: cocoa xcode objective-c iphone development programming debugging) [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1477</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Mon, 04 Oct 2010 12:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1477</guid>
		<description>&lt;p&gt;The example in this article is backwards.  The line should read (as it does in my code samples n github):&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;ZAssert([moc save:&amp;error], ....
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The example in this article is backwards.  The line should read (as it does in my code samples n github):</p>

<p><pre><code>ZAssert([moc save:&amp;error], ....
</code></pre></p>]]></content:encoded>
	</item>
	<item>
		<title>By: tarasis</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1475</link>
		<dc:creator>tarasis</dc:creator>
		<pubDate>Mon, 04 Oct 2010 09:56:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1475</guid>
		<description>&lt;p&gt;Okay lesson learnt, don&#039;t put code in comments :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Okay lesson learnt, don&#8217;t put code in comments :)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: tarasis</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1474</link>
		<dc:creator>tarasis</dc:creator>
		<pubDate>Mon, 04 Oct 2010 09:55:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1474</guid>
		<description>&lt;p&gt;Markus, I shaynesweeney is right in so far as your example in the article is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
NSError *error = nil;
ZAssert(![managedObjectContext save:&amp;error], @&quot;My save failed: %@&#092;n%@&quot;, [error localizedDescription], [error userInfo]);
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So if save: returns a Yes, you are inverting it before passing it to ZAssert which then promptly re-inverts it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/p&gt;

&lt;p&gt;define ZAssert(condition, ...) do { if (!(condition)) { ALog(&lt;strong&gt;VA_ARGS&lt;/strong&gt;); }} while(0)&lt;/p&gt;

&lt;p&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So a successful save goes from YES-&gt;NO-&gt;YES and an ALog is produced. I know first hand as it just happened to me :)&lt;/p&gt;

&lt;p&gt;This works as expected
&lt;code&gt;
//      if (![self.managedObjectContext save:&amp;error]) {
//          NSLog(@&quot;My save failed: %@&#092;n%@&quot;, [error localizedDescription], [error userInfo]);
//          abort();
//      }
ZAssert([self.managedObjectContext save:&amp;error], @&quot;My save failed: %@&#092;n%@&quot;, [error localizedDescription], [error userInfo]);
&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Markus, I shaynesweeney is right in so far as your example in the article is:</p>

<p><code>
NSError *error = nil;
ZAssert(![managedObjectContext save:&amp;error], @"My save failed: %@&#092;n%@", [error localizedDescription], [error userInfo]);
</code></p>

<p>So if save: returns a Yes, you are inverting it before passing it to ZAssert which then promptly re-inverts it.</p>

<p><code></code></p>

<p>define ZAssert(condition, ...) do { if (!(condition)) { ALog(<strong>VA_ARGS</strong>); }} while(0)</p>

<p></p>

<p>So a successful save goes from YES-&gt;NO-&gt;YES and an ALog is produced. I know first hand as it just happened to me :)</p>

<p>This works as expected
<code>
//      if (![self.managedObjectContext save:&amp;error]) {
//          NSLog(@"My save failed: %@&#092;n%@", [error localizedDescription], [error userInfo]);
//          abort();
//      }
ZAssert([self.managedObjectContext save:&amp;error], @"My save failed: %@&#092;n%@", [error localizedDescription], [error userInfo]);
</code></p>]]></content:encoded>
	</item>
	<item>
		<title>By: XCode tips &#171; Franz Blog</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1422</link>
		<dc:creator>XCode tips &#171; Franz Blog</dc:creator>
		<pubDate>Sun, 15 Aug 2010 17:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1422</guid>
		<description>&lt;p&gt;[...] Cocoa Is My Girlfriend &#8211; My current Prefix.pch file [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Cocoa Is My Girlfriend &#8211; My current Prefix.pch file [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Bynomial Code &#187; Preprocessor debugging goodies</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1351</link>
		<dc:creator>Bynomial Code &#187; Preprocessor debugging goodies</dc:creator>
		<pubDate>Tue, 11 May 2010 22:52:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1351</guid>
		<description>&lt;p&gt;[...] Cocoa is My Girlfriend (also includes assert-related tricks) [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Cocoa is My Girlfriend (also includes assert-related tricks) [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1346</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Fri, 07 May 2010 22:23:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1346</guid>
		<description>&lt;p&gt;The license is BSD as usually :). Feel free to use it as you want.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The license is BSD as usually :). Feel free to use it as you want.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: jmp</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1345</link>
		<dc:creator>jmp</dc:creator>
		<pubDate>Fri, 07 May 2010 22:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1345</guid>
		<description>&lt;p&gt;Cool, Marcus, this is better than what I was using. What&#039;s the license on this?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Cool, Marcus, this is better than what I was using. What&#8217;s the license on this?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1344</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Wed, 05 May 2010 00:37:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1344</guid>
		<description>&lt;p&gt;The logic is correct.  ZAssert should pass on a true which it does.  Therefore a [moc save:&amp;error] that returns YES will pass through as it should and one that failes with a NO will produce an error.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The logic is correct.  ZAssert should pass on a true which it does.  Therefore a [moc save:&amp;error] that returns YES will pass through as it should and one that failes with a NO will produce an error.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: shaynesweeney</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1343</link>
		<dc:creator>shaynesweeney</dc:creator>
		<pubDate>Tue, 04 May 2010 23:19:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1343</guid>
		<description>&lt;p&gt;Your ZAssert macro and example implementation conflict, correct me if I&#039;m wrong.&lt;/p&gt;

&lt;p&gt;The macro&#039;s conditional statement would read &quot;if not condition&quot;. The example implementation applies a &quot;not [save success?]&quot;.&lt;/p&gt;

&lt;p&gt;As such the condition is built as follows, given a successful save: &quot;if not (not true)&quot;.&lt;/p&gt;

&lt;p&gt;ZAssert raises an exception when the save is successful, which is the opposite of the desired outcome.&lt;/p&gt;

&lt;p&gt;Easy fix: Remove the &quot;!&quot; from the condition defined in the macro or the &quot;!&quot; from the first argument passed to ZAssert.&lt;/p&gt;

&lt;p&gt;Remaining consistent given it&#039;s common to pass &quot;if not&quot; logic to NSAssert, I&#039;ve opted to change the macro&#039;s conditional to &quot;if (condition)&quot;. The implementation remains consistent with your example as well as existing NSAssert calls.&lt;/p&gt;

&lt;p&gt;Thoughts?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Your ZAssert macro and example implementation conflict, correct me if I&#8217;m wrong.</p>

<p>The macro&#8217;s conditional statement would read &#8220;if not condition&#8221;. The example implementation applies a &#8220;not [save success?]&#8220;.</p>

<p>As such the condition is built as follows, given a successful save: &#8220;if not (not true)&#8221;.</p>

<p>ZAssert raises an exception when the save is successful, which is the opposite of the desired outcome.</p>

<p>Easy fix: Remove the &#8220;!&#8221; from the condition defined in the macro or the &#8220;!&#8221; from the first argument passed to ZAssert.</p>

<p>Remaining consistent given it&#8217;s common to pass &#8220;if not&#8221; logic to NSAssert, I&#8217;ve opted to change the macro&#8217;s conditional to &#8220;if (condition)&#8221;. The implementation remains consistent with your example as well as existing NSAssert calls.</p>

<p>Thoughts?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Sweet Prefix.pch file &#171; Tony&#39;s Notebook</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1342</link>
		<dc:creator>Sweet Prefix.pch file &#171; Tony&#39;s Notebook</dc:creator>
		<pubDate>Tue, 04 May 2010 15:17:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1342</guid>
		<description>&lt;p&gt;[...] the description at Cocoa is my Girlfriend.            &#160;    No [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] the description at Cocoa is my Girlfriend.            &nbsp;    No [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Diederik Hoogenboom</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1341</link>
		<dc:creator>Diederik Hoogenboom</dc:creator>
		<pubDate>Mon, 03 May 2010 10:00:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1341</guid>
		<description>&lt;p&gt;Another suggestion for a Prefix.pch entry is the following:&lt;/p&gt;

&lt;p&gt;static inline BOOL IsEmpty(id thing) {
    return thing == nil
        &#124;&#124; ([thing respondsToSelector:@selector(length)]
        &amp;&amp; [(NSData *)thing length] == 0)
        &#124;&#124; ([thing respondsToSelector:@selector(count)]
        &amp;&amp; [(NSArray *)thing count] == 0);
}&lt;/p&gt;

&lt;p&gt;This can come in handy is you want to check if a NSString, NSArray, NSSet or NSData variable is empty (variable is nil or does not contain any elements).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Another suggestion for a Prefix.pch entry is the following:</p>

<p>static inline BOOL IsEmpty(id thing) {
    return thing == nil
        || ([thing respondsToSelector:@selector(length)]
        &amp;&amp; [(NSData *)thing length] == 0)
        || ([thing respondsToSelector:@selector(count)]
        &amp;&amp; [(NSArray *)thing count] == 0);
}</p>

<p>This can come in handy is you want to check if a NSString, NSArray, NSSet or NSData variable is empty (variable is nil or does not contain any elements).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1340</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Mon, 03 May 2010 06:11:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1340</guid>
		<description>&lt;p&gt;Your ALog is functionally no different than just NSLog.  The ALog I have defined above will stop code execution if it is hit.  IMHO there is NEVER a reason to &lt;em&gt;always&lt;/em&gt; log something.  Logging slows down program execution and can cause fun synchronization bugs so should be turned off in production code in all except the most extreme situations (like the code is going to crash anyway).&lt;/p&gt;

&lt;p&gt;As for the do {} while (0) instead of nothing is because there are a few rare code situations where replacing DLog(@&quot;&quot;); with ; can cause issues.  Replacing it with do {} while(0); is safer in those rare cases and will get optimized out by the compiler anyway.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Your ALog is functionally no different than just NSLog.  The ALog I have defined above will stop code execution if it is hit.  IMHO there is NEVER a reason to <em>always</em> log something.  Logging slows down program execution and can cause fun synchronization bugs so should be turned off in production code in all except the most extreme situations (like the code is going to crash anyway).</p>

<p>As for the do {} while (0) instead of nothing is because there are a few rare code situations where replacing DLog(@&#8221;"); with ; can cause issues.  Replacing it with do {} while(0); is safer in those rare cases and will get optimized out by the compiler anyway.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan de Vries</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1339</link>
		<dc:creator>Nathan de Vries</dc:creator>
		<pubDate>Mon, 03 May 2010 04:12:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1339</guid>
		<description>&lt;p&gt;This might work a little better:&lt;/p&gt;

&lt;p&gt;http://gist.github.com/387747&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This might work a little better:</p>

<p><a href="http://gist.github.com/387747" rel="nofollow">http://gist.github.com/387747</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan de Vries</title>
		<link>http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/comment-page-1/#comment-1338</link>
		<dc:creator>Nathan de Vries</dc:creator>
		<pubDate>Mon, 03 May 2010 04:08:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=977#comment-1338</guid>
		<description>&lt;p&gt;I also use DLog() and ALog() macros, however my ALog() macro means &quot;always log&quot; rather than &quot;assert log&quot;. My macros look like this:&lt;/p&gt;

&lt;p&gt;define ALog(format, ...) NSLog((@&quot;%s [L%d] &quot; format), &lt;strong&gt;PRETTY_FUNCTION&lt;/strong&gt;, &lt;strong&gt;LINE&lt;/strong&gt;, ##&lt;strong&gt;VA_ARGS&lt;/strong&gt;);&lt;/p&gt;

&lt;p&gt;ifdef DEBUG&lt;/p&gt;

&lt;p&gt;define DLog(format, ...) ALog(format, ##&lt;strong&gt;VA_ARGS&lt;/strong&gt;);&lt;/p&gt;

&lt;p&gt;else&lt;/p&gt;

&lt;p&gt;define DLog(...)&lt;/p&gt;

&lt;p&gt;endif&lt;/p&gt;

&lt;p&gt;Is there any reason why you expand DLog() to &quot;do { } while (0)&quot; when DEBUG is undefined, rather than nothing?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I also use DLog() and ALog() macros, however my ALog() macro means &#8220;always log&#8221; rather than &#8220;assert log&#8221;. My macros look like this:</p>

<p>define ALog(format, &#8230;) NSLog((@&#8221;%s [L%d] &#8221; format), <strong>PRETTY_FUNCTION</strong>, <strong>LINE</strong>, ##<strong>VA_ARGS</strong>);</p>

<p>ifdef DEBUG</p>

<p>define DLog(format, &#8230;) ALog(format, ##<strong>VA_ARGS</strong>);</p>

<p>else</p>

<p>define DLog(&#8230;)</p>

<p>endif</p>

<p>Is there any reason why you expand DLog() to &#8220;do { } while (0)&#8221; when DEBUG is undefined, rather than nothing?</p>]]></content:encoded>
	</item>
</channel>
</rss>

