<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bugflux.org &#187; c</title>
	<atom:link href="http://bugflux.org/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://bugflux.org</link>
	<description>André Prata, nDray</description>
	<lastBuildDate>Fri, 16 Sep 2011 07:54:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>casting malloc&#8230;</title>
		<link>http://bugflux.org/blog/580:casting-malloc/</link>
		<comments>http://bugflux.org/blog/580:casting-malloc/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:39:36 +0000</pubDate>
		<dc:creator>nDray</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://bugflux.org/?p=580</guid>
		<description><![CDATA[&#8230; is a matter most c programmers have questioned themselves about once or twice, at least, by now. to do or not to do, that is the question! i have been recently penalized by 2.5 percent in a program, along &#8230; <a href="http://bugflux.org/blog/580:casting-malloc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&#8230; is a matter most c programmers have questioned themselves about once or twice, at least, by now. to do or not to do, that is the question! i have been recently penalized by 2.5 percent in a program, along with a colleague, by not casting the result of the malloc function (a pointer to void, void *) to whatever type we want to use. we have questioned ourselves sometimes before the submission of the work, and so we went and searched for it on google. small forum conversations and programming tutorials suggested that this was no longer necessary, since the void pointer was created to leave the char pointer behind as the arbitrary pointer to objects (data). that was when we decided not to cast.<br />
<span id="more-580"></span><br />
so today, a few weeks later, the <a href="http://sweet.ua.pt/~f706/" title="adrego da rocha @ ua.pt" target="_blank">teacher</a> tells us (sorry, we asked!!) we lost some points by not casting the attribution from malloc. so i grabbed the <a href="http://www.lysator.liu.se/c/rat/title.html" title="rationale for the ansi c @ lysator.liu.se" target="_blank">rationale for the ansi c programming language</a>, where two things are clearly stated:</p>
<ol>
<li>the pointer to void is a generic pointer, an invention by the ansi comitee to drop the usage of char * as the arbitrary object pointer;
<li>a pointer to void may be converted to a pointer to any object of any type and vice-versa. even more, the result of the opposite operation compares equal do the original pointer.
</ol>
<p>a further reading of the text points the reader in the direction that the conversion is done by simple operations, assignment included, not explicit casts.</p>
<p>so, as many people has been preaching in the internet, casting a pointer to void only grants that the user is demanding the compiler to do something it would do anyway. more than that, casting makes you write more code and, when changing code, makes it easier to produce hard to find bugs (imagine you cast, then you change data types, but not the cast!). so, since i&#8217;m more or less an advocate of the <a href="http://suckless.org/common/" title="common @ suckless.org" target="_blank">suckless philosophy</a>, i&#8217;m not casting!</p>
]]></content:encoded>
			<wfw:commentRss>http://bugflux.org/blog/580:casting-malloc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>setsolver&#8230;</title>
		<link>http://bugflux.org/blog/12:setsolver/</link>
		<comments>http://bugflux.org/blog/12:setsolver/#comments</comments>
		<pubDate>Mon, 26 May 2008 22:15:26 +0000</pubDate>
		<dc:creator>nDray</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://bugflux.org/wp/?p=18</guid>
		<description><![CDATA[&#8230; solves set games download version 20080411 this program was written to compete in a programming challenge. it did not finish in first place, but it was competing with multitasking software! i really think the idea of my program would &#8230; <a href="http://bugflux.org/blog/12:setsolver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&#8230; solves <a href="http://en.wikipedia.org/wiki/Set_game" title="set at wikipedia" target="_blank">set</a> games<br />
download version <a href="/bugdev/setsolver/setsolver-20080411.tar.gz" title="setsolver">20080411</a><br />
<span id="more-12"></span><br />
this program was written to compete in a <a href="http://cplus.about.com/od/programmingchallenges/a/challenge11.htm" title="programming challenge 11 @ cplus.about" target="_blank">programming challenge</a>. it did not finish in first place, but it was competing with multitasking software! i really think the idea of my program would be killer, and still think it is, the way i encoded the cards and solved their matching. the program is useless, but the idea is worth sharing!</p>
]]></content:encoded>
			<wfw:commentRss>http://bugflux.org/blog/12:setsolver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lockx&#8230;</title>
		<link>http://bugflux.org/blog/9:lockx/</link>
		<comments>http://bugflux.org/blog/9:lockx/#comments</comments>
		<pubDate>Sat, 24 May 2008 20:16:10 +0000</pubDate>
		<dc:creator>nDray</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://bugflux.org/wp/?p=15</guid>
		<description><![CDATA[&#8230; locks your screen until the user&#8217;s password is typed download version 20080829 and PKGBUILD. heavily based on slock, it&#8217;s meant to lock X11 sessions. unlike slock, it doesn&#8217;t need you to press enter in order to validate the password, &#8230; <a href="http://bugflux.org/blog/9:lockx/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&#8230; locks your screen until the user&#8217;s password is typed<br />
download version <a title="lockx" href="/bugdev/lockx/lockx-20080829.tar.gz">20080829</a> and <a title="PKGBUILD" href="/bugdev/lockx/PKGBUILD">PKGBUILD</a>.<br />
<span id="more-9"></span><br />
heavily based on <a title="xlib @ suckless" href="http://www.suckless.org/wiki/tools/xlib" target="_blank">slock</a>, it&#8217;s meant to lock X11 sessions.</p>
<p>unlike slock, it doesn&#8217;t need you to press <em>enter</em> in order to validate the password, neither to clear the input when you mistype. instead it just reads the characters and if you inputted your password correctly it will unlock the session.</p>
<p>it might take a bit to unlock the session because power the state imposed sometimes require a few seconds to recover.</p>
]]></content:encoded>
			<wfw:commentRss>http://bugflux.org/blog/9:lockx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

