{"thread":{"id":"24232","subject":"Purpose of \"struct object_entry *oe = oe;\"?","startedAt":"2010-06-29T12:28:19Z","lastAt":"2010-07-02T09:28:51Z","messageCount":4,"participants":["Bruce Stephens","Joshua Juran","David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"144457","messageId":"8039w681lo.fsf@tiny.isode.net","threadId":"24232","inReplyTo":null,"subject":"Purpose of \"struct object_entry *oe = oe;\"?","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2010-06-29T12:28:19Z","receivedAt":"2010-06-29T12:28:19Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"Out of curiousity, where did this convention/idiom come from, and what's\nit for?\n\nI presume it's to remove a warning (\"oe might be used uninitialised\") on\na compiler (or something) that's clever enough to attempt such analysis\nbut too stupid to notice that the supposed initialisation is using\nsomething uninitialised (or perhaps the compiler's deliberately\nrecognising the convention?).  Is that right, or does it actually do\nsomething more?\n\nI'm mostly surprised that it surprises me.  Is it used commonly in other\nprojects?  (It appears not to be mentioned in CodingGuidelines; should\nit be?)\n\n(First instance in git that I can see is\n67affd5173da059ca60aab7896985331acacd9b4, 2006.)\n"},{"id":"144654","messageId":"69D6E995-8F0E-446C-90CD-758C160A7807@gmail.com","threadId":"24232","inReplyTo":"8039w681lo.fsf@tiny.isode.net","subject":"Re: Purpose of \"struct object_entry *oe = oe;\"?","fromName":"Joshua Juran","fromEmail":"jjuran@gmail.com","sentAt":"2010-07-02T01:43:47Z","receivedAt":"2010-07-02T01:43:47Z","isPatch":false,"sender":{"key":"jjuran@gmail.com","avatar":null},"body":"On Jun 29, 2010, at 5:28 AM, Bruce Stephens wrote:\n\n> Out of curiousity, where did this convention/idiom come from, and  \n> what's\n> it for?\n>\n> I presume it's to remove a warning (\"oe might be used  \n> uninitialised\") on\n> a compiler (or something) that's clever enough to attempt such  \n> analysis\n> but too stupid to notice that the supposed initialisation is using\n> something uninitialised (or perhaps the compiler's deliberately\n> recognising the convention?).  Is that right, or does it actually do\n> something more?\n>\n> I'm mostly surprised that it surprises me.  Is it used commonly in  \n> other\n> projects?  (It appears not to be mentioned in CodingGuidelines; should\n> it be?)\n\nI was wondering this myself.  My compiler complains in (and only in)  \nthe *presence* of this idiom, rather than its absence, so I undid it:\n\njj/warn/uninitialized branch on GitHub\nhttp://github.com/jjuran/git/tree/jj/warn/uninitialized\n\njj/warn/uninitialized commit on GitHub\nhttp://github.com/jjuran/git/commit/ \n8affbf2d8e46fbd5f3d6898aa07ea8548432e7bc\nSigned-Off-By:  Joshua Juran <jjuran@gmail.com> (or s/gmail/metamage/)\n\nA compiler that warns of uninitialized usage *unless* a variable is  \ninitialized *with itself* is doubly broken.\n\nCheers,\nJosh\n"},{"id":"144673","messageId":"20100702084846.GA4682@gmail.com","threadId":"24232","inReplyTo":"8039w681lo.fsf@tiny.isode.net","subject":"Re: Purpose of \"struct object_entry *oe = oe;\"?","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2010-07-02T08:48:48Z","receivedAt":"2010-07-02T08:48:48Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Tue, Jun 29, 2010 at 01:28:19PM +0100, Bruce Stephens wrote:\n> Out of curiousity, where did this convention/idiom come from, and what's\n> it for?\n> \n> I presume it's to remove a warning (\"oe might be used uninitialised\") on\n> a compiler (or something) that's clever enough to attempt such analysis\n> but too stupid to notice that the supposed initialisation is using\n> something uninitialised (or perhaps the compiler's deliberately\n> recognising the convention?).  Is that right, or does it actually do\n> something more?\n> \n> I'm mostly surprised that it surprises me.  Is it used commonly in other\n> projects?  (It appears not to be mentioned in CodingGuidelines; should\n> it be?)\n> \n> (First instance in git that I can see is\n> 67affd5173da059ca60aab7896985331acacd9b4, 2006.)\n\n\nThere are some good explanations in the list archives.\nhttp://thread.gmane.org/gmane.comp.version-control.git/133278/focus=133422\nhttp://thread.gmane.org/gmane.comp.version-control.git/124676/focus=124803\n\n\n-- \n\t\tDavid\n"},{"id":"144675","messageId":"80iq4y44h8.fsf@tiny.isode.net","threadId":"24232","inReplyTo":"20100702084846.GA4682@gmail.com","subject":"Re: Purpose of \"struct object_entry *oe = oe;\"?","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2010-07-02T09:28:51Z","receivedAt":"2010-07-02T09:28:51Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"David Aguilar <davvid@gmail.com> writes:\n\n[...]\n\n> There are some good explanations in the list archives.\n> http://thread.gmane.org/gmane.comp.version-control.git/133278/focus=133422\n> http://thread.gmane.org/gmane.comp.version-control.git/124676/focus=124803\n\nThanks.  That matches my guess.\n\nWouldn't it be useful to mention it in CodingGuidelines?\n\nA danger is that the declaration (that yes, this really is initialised\nbefore use) becomes invalid during further changes, so it's best if\neverybody concerned understands the convention.\n\nObviously if it's a commonly understood and used convention then it's\njust as well not to have it in CodingGuidelines, but I'm not convinced\nthat this one is, though (having noticed it) the intention isn't hard to\ngrok.\n"}]}