<?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>JB Enterprises – Johan Bezem</title>
	<atom:link href="http://www.bezem.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bezem.de</link>
	<description>Development &#38; Project Management</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:22:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Finally: A list of C (and C++) keywords including C11 (and C++11)</title>
		<link>http://www.bezem.de/2012/01/finally-a-list-of-c-and-c-keywords-including-c11-and-c11/</link>
		<comments>http://www.bezem.de/2012/01/finally-a-list-of-c-and-c-keywords-including-c11-and-c11/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 18:22:17 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[c11]]></category>
		<category><![CDATA[keyword]]></category>
		<category><![CDATA[standard]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=370</guid>
		<description><![CDATA[A list of C and C++ keywords and their origins, to be found in my <a href="http://www.bezem.de/pdf/ReservedWordsInC.pdf">PDF collection</a>.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while, but now I have some news: Since I didn&#8217;t receive much response to requests in <a href="http://stackoverflow.com/q/8139659/1029106">StackOverflow</a> nor on my blog, I decided to create such a list myself. The preliminary output can be found <a href="http://www.bezem.de/pdf/ReservedWordsInC.pdf">here</a>, as a PDF as usual. It&#8217;s version 0.4 for now, and not fully complete, but I&#8217;ve added several sources, from pre-K&#038;R to C11, and from C++ 1st edition (1985), to C++11.<br/> If you find inaccuracies, please let me know, either as a comment, or by email. I intend to bring out updated editions whenever new info warrants it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2012/01/finally-a-list-of-c-and-c-keywords-including-c11-and-c11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming in the C/C++ realm: Identifier names to avoid &#8211; or not?</title>
		<link>http://www.bezem.de/2009/11/programming-in-the-cc-realm-identifier-names-to-avoid-or-not/</link>
		<comments>http://www.bezem.de/2009/11/programming-in-the-cc-realm-identifier-names-to-avoid-or-not/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:57:24 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[identifier name]]></category>
		<category><![CDATA[keyword]]></category>
		<category><![CDATA[standard]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=267</guid>
		<description><![CDATA[The difficulties of finding all keywords from the C/C++ realm, to be avoided when choosing identifier names.]]></description>
			<content:encoded><![CDATA[<p>The C family of languages has been around for a while, has evolved, grown, sprouted a few branches and now provides several paths for &#8216;growth&#8217;. Starting out in the seventies, standardized in the eighties, C++ in the nineties, standardized even more recently, industry-standard variants available for embedded (C++), and new standardization efforts on the way. Wonderful!<br />
Currently, just as many times before, I&#8217;m working on a project with fairly high safety requirements, programmed in C. Not C99, but C89 with a few compiler extensions for embedded programming. Not because C++ or at least C99 is not available, but because of the inertia of legacy code, and the experience level of the (otherwise highly skilled) developers. You don&#8217;t turn a team of experts in C into a team of experts in C++ within a few weeks, and the project&#8217;s goals take priority always.<br />
A few weeks ago I was looking at a piece of code like this:<br />
<code>ui32 calculate_difference(ui32 old, ui32 new) { ... }</code><br />
That gave me pause. Yes, it&#8217;s perfectly OK for C89, even C99 will not complain. But do I really want to use a C++ keyword in my C code? If ever I get to move to C++, my code <strong>must</strong> break!<br />
Having been a brief and passing guest at the <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/meetings">C++ WG21 July 2009 meeting in Frankfurt</a>, I started off on some research. (This list is just for illustration, not for completeness)</p>
<ul>
<li>An interesting keyword from the old days has been forgotten since C89: <code>entry</code></li>
<li>C89 introduced a new keyword <code>void</code></li>
<li>AMD1 introduced some new semi-keywords: <code>or_eq</code>, <code>and_eq</code>. These are not keywords in the pure sense, but you might still want to avoid them as identifier names</li>
<li>C99 added at least one more: <code>restrict</code></li>
<li>C++ adds a whole army of keywords: <code>static_cast</code>, <code>template</code>, <code>class</code></li>
<li>The coming C/C++ standards will add several more: <code>_Complex</code>, <code>_Imaginary</code></li>
</ul>
<p>So I&#8217;m now trying to find out answers to the following question: What identifier names would I want to avoid in my code, considering the vast realm of C/C++ language variants and dialects. So I started off with the keywords of all standards; then I looked into the coming standards, then I looked at the might-be keywords, packaged as macros, like complex, imaginary, decimal64, etc. The list grew, I lost my overview, however slim it had been, and I didn&#8217;t even start on the various (Standard!) libraries!<br />
I&#8217;m now starting on a more structured approach. A <a href="https://twitter.com/LintTweets">quick tweet</a> didn&#8217;t get me any response. Many overviews on the net present parts, but nothing comprehensive as far as I&#8217;ve seen, so I guess I&#8217;ll have to roll my own.<br />
If you happen to know a source of information on this, please do let me know, either as comment, or by email. I&#8217;d be more than interested.<br />
And whether you do or don&#8217;t, you&#8217;re welcome to come back here occasionally, as I&#8217;ll be reporting my findings.<br />
Happy coding!</p>
<p>Johan</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/11/programming-in-the-cc-realm-identifier-names-to-avoid-or-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bizarre switch statement in C</title>
		<link>http://www.bezem.de/2009/11/bizarre-switch-statement-in-c/</link>
		<comments>http://www.bezem.de/2009/11/bizarre-switch-statement-in-c/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 05:25:47 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[General development]]></category>
		<category><![CDATA[C programming bizarre]]></category>
		<category><![CDATA[static syntax checking]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=256</guid>
		<description><![CDATA[An example of what can be legally done in C illustrated in form of a rather bizarre switch-statement.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been in my &#8220;Bizarre C&#8221; box for many years. Things you may want or need to know about, but never would want to duplicate.</p>
<p>Currently, I am researching for a new publication, maybe a PDF document, maybe a course, on the nooks an crannies of the C programming language. And I&#8217;m finding some abstruse samples, I can tell you.</p>
<p>But one example I found most bizarre at the time (around 1990), and which still is among my favorites to flabbergast experienced C programmers, I found in the best C programming reference I&#8217;ve known to date: &#8220;<a href="http://www.amzn.com/013089592X">C &#8211; A Reference Manual</a>&#8221; by Samuel P. Harbison and Guy L. Steele (see also the <a href="http://www.careferencemanual.com/">book&#8217;s website</a>).</p>
<p>Imagine a calculation depending on certain numbers being prime or not. If the routine gets a prime parameter it executes one routine, if the parameter is not prime, another. Like this:<br />
<code>if (is_prime(a))<br />
Â·Â·process_prime(a);<br />
else<br />
Â·Â·process_nonprime(a);</code><br />
The <code>if</code>-statement is just that, a statement, a composite statement.<br />
A <code>switch</code>-statement is composed of a <code>switch</code> keyword, the value on which to operate, and a, possibly composite, statement. It could be our <code>if</code>-statement, if we so choose. However, without any <code>case</code>/<code>default</code>-labels, the <code>switch</code>-statement would just jump over the statement so specified, effectively doing nothing. To remedy that, we put the <code>default</code>-label before the <code>if</code>-statement:<br />
<code>switch (a)<br />
Â·Â·default:<br />
Â·Â·Â·Â·if (is_prime(a))<br />
Â·Â·Â·Â·Â·Â·process_prime(a);<br />
Â·Â·Â·Â·else<br />
Â·Â·Â·Â·Â·Â·process_nonprime(a);</code><br />
This code already looks strange, but it is functionally equivalent to the <code>if</code>-statement by itself.<br />
If we now imagine the function <code>is_prime(a)</code> to be very expensive, it would make sense to take a shortcut around that function wherever possible. And if 99% of the values the variable <code>a</code> can have lie between 2 and 10 inclusive, it definitely would make sense to circumvent the <code>is_prime()</code> function, since we know the primeness of those values without calculation:<br />
<code>switch (a)<br />
Â·Â·default:<br />
Â·Â·Â·Â·if (is_prime(a))<br />
Â·Â·case 2: case 3: case 5: case 7:<br />
Â·Â·Â·Â·Â·Â·process_prime(a);<br />
Â·Â·Â·Â·else<br />
Â·Â·case 4: case 6: case 8: case 9: case 10:<br />
Â·Â·Â·Â·Â·Â·process_nonprime(a);</code><br />
To understand why this is correct C, we need to realize that <code>case</code>-labels belonging to a <code>switch</code>-statement can be positioned anywhere within the boundaries of the composite statement belonging to the <code>switch</code>. In our case, this means until the semicolon after the <code>process_nonprime(a)</code> statement.<br />
It works as follows:</p>
<ul>
<li>If <code>a</code> is 3 upon execution of the <code>switch</code>, the label <code>case 3:</code> is where execution continues after determining the value of <code>a</code> to be three, jumping into the middle of the <code>if</code>-statement and calling the function <code>process_prime</code> with a parameter 3. After execution of that function, the <code>if</code>-statement is terminated, terminating the enclosing <code>switch</code>-statement at the same time.</li>
<li>If <code>a</code> is 8 upon execution of the <code>switch</code>, the label <code>case 8:</code> is where execution continues after determining the value of <code>a</code> to be eight, jumping into the middle of the <code>if</code>-statement and calling the function <code>process_nonprime</code> with a parameter 8. After execution of that function, the <code>if</code>-statement is terminated, terminating the enclosing <code>switch</code>-statement at the same time.</li>
<li>If <code>a</code> is 29 upon execution of the <code>switch</code>, the label <code>default:</code> is where execution continues after determining that no known value is to be processed, executing the <code>if</code>-statement from its beginning. Depending on the value of <code>a</code> (29 in this case) the <code>if</code>-condition determines which of the two alternative functions to call, just like a normal <code>if</code>-statement.</li>
</ul>
<p>I can only agree with Sam Harbison and Guy Steele: &#8220;This is frankly the most bizarre switch statement we have ever seen that still has pretenses to being purposeful.&#8221;<br />
Would you want the nuclear reactor around the corner being coded like this?<br />
Happy coding!</p>
<p>Johan</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/11/bizarre-switch-statement-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PC Lint in Eclipse &#8211; no plug-ins required</title>
		<link>http://www.bezem.de/2009/08/using-pc-lint-in-eclipse-no-plug-ins-required/</link>
		<comments>http://www.bezem.de/2009/08/using-pc-lint-in-eclipse-no-plug-ins-required/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 16:51:02 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[PC Lint / FlexeLint]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[ErrorParser]]></category>
		<category><![CDATA[Lint]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=245</guid>
		<description><![CDATA[Using PC Lint from Eclipse doesn't require any plug-ins, just the proper configuration. Here's how!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been tinkering with Eclipse to see if I can make PC Lint run from inside Eclipse. Of course, running Lint as an external tool is always an option, but I couldn&#8217;t get Eclipse to recognize the Lint warnings and display them in the &#8216;Problems&#8217; tab. From my testing and what I could find in the Internet, it seems that the output of so-configured external tools is not run by the error parsers installed.</p>
<p>What I found in the Internet suggested that I have to use a special error parser, configure that, and then it would run. Now, I have nothing against using extra tools if that&#8217;s the way to achieve what I want, but if I can do without, I consider that a better solution, since every tool used is another tool to learn how to use. And delivering configurations to my customers,Â  it&#8217;s not my business model to make myself indispensable, on the contrary.</p>
<p>So, after experimenting some more, I have found a way to use PC Lint with Eclipse (I used Ganymede for testing) without resorting to additional tools or plug-ins. Be aware, I&#8217;m not an Eclipse expert in any sense, so there may be many more and possibly better ways to achieve this. I&#8217;d be happy to get some comments with further tips.</p>
<p>The key is to add a new &#8216;build target&#8217; for running PC Lint:</p>
<ol>
<li>On the properties dialog for the workspace (right-click and select &#8216;Properties&#8217;), in the &#8216;Builders&#8217; section, check that the &#8220;CDT Builder&#8221; is selected.</li>
<li>In the &#8216;C/C++ Build&#8217; section, click on &#8220;Manage Configurations&#8230;&#8221; and add a configuration for running Lint.</li>
<li>Select the configuration from the drop-down box.</li>
<li>On the &#8216;Builder Settings&#8217; tab, deselect the &#8220;Use default build command&#8221; and instead provide the path to the Lint executable, eg. &#8220;C:\Lint90\LINT-NT.EXE&#8221;. Specify the &#8216;Build location&#8217;, from which directory you want Lint to run, either absolute or using the buttons offered.</li>
<li>On the &#8216;Behaviour&#8217; tab, deselect &#8220;clean&#8221;, and provide the parameters to Lint in the (selected) &#8216;Build (Incremental build)&#8217; text box.</li>
<p>Be aware that these indications all assume some kind of a general build or make environment, so the names themselves do not indicate the possibility for running a single program. If you use a Makefile concept for running Lint, you may use that as well, and &#8216;clean&#8217; might even make sense.</p>
<li>In the &#8216;Settings&#8217; section of &#8216;C/C++ Build&#8217;, make sure that all CDT parsers (or at least the &#8220;CDT GNU C/C++ Error Parser&#8221;) are selected.</li>
</ol>
<p>And that&#8217;s it.</p>
<p>OK; one final thing remains. We now need to coerce Lint into providing warnings in a format similar to the GNU C/C++ compiler. This can be achieved by some Lint options in your option file. I use:</p>
<p><code> // Output options: One line, file info always; Use full path names</p>
<p>-hF1</p>
<p>+ffn</p>
<p>// Normally my format is defined as follows:</p>
<p>//-"format=%(\q%f\q %l %C%) %t %n: %m"</p>
<p>// For eclipse-usage, the GCC error format is necessary,</p>
<p>// since we have only the default eclipse error parser available.</p>
<p>-"format=%(%f:%l:%C:%) %t %n: %m"</code></p>
<p>// And also for eclipse, the reference locations provided by</p>
<p>// Lint, put into square brackets &#8220;[Reference: File: ... Line: ...]&#8221;</p>
<p>// are not correctly handled, therefore we switch them off.</p>
<p>// Enable warning 831 if you are interested.</p>
<p>-frl</p>
<p>// Do not break lines</p>
<p>-width(0)</p>
<p>// And make sure no foreign includes change the format</p>
<p>+flm</p>
<p>If you want to know more than my comments are telling you, check the Lint manual for details.</p>
<p>Now, don&#8217;t get me wrong: I will not switch from my trusted SlickEdit to Eclipse. But, as a consultant, I cannot always pick and choose. And running Lint from Eclipse, having a way to jump from warning to warning, definitely beats manual navigation.</p>
<p>Happy Linting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/08/using-pc-lint-in-eclipse-no-plug-ins-required/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Virtualisation, VMWare, SysPrep &#8211; not as easy as it seems</title>
		<link>http://www.bezem.de/2009/04/virtualisation-vmware-sysprep-not-as-easy-as-it-seems/</link>
		<comments>http://www.bezem.de/2009/04/virtualisation-vmware-sysprep-not-as-easy-as-it-seems/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 11:36:24 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[Windows Administration]]></category>
		<category><![CDATA[clone]]></category>
		<category><![CDATA[SysPrep]]></category>
		<category><![CDATA[virtualisation]]></category>
		<category><![CDATA[VMWare]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=232</guid>
		<description><![CDATA[A collection of links to a series written by David Remy on the use of SysPrep (among others), collected here in reading order.]]></description>
			<content:encoded><![CDATA[<p>If you know me, you know I am a Windows power-user, but certainly not an experienced administrator. If you are then confronted with a potential roll-out for a VMWare-based development environment to be legally cloned from a master environment using XP, things seem easy at first: Install, copy, distribute.<br />
If you then look into things like hostnames, WinXP activiation, simultaneous network access, things become more complicated. And if you then start looking into something like SysPrep (not for Vista), things can easily overwhelm you.<br />
So, more for me than for you :-) I&#8217;ve collected a set of links from <a href="http://remyservices.wordpress.com/">remyservices.wordpress.com</a> (David Remy) going through much of the necessary details using SysPrep. Thanks, David!</p>
<ul>
<li><a href="http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-1-adding-drivers-to-our-image-pc/">SysPrep in Depth &#8211; Part 1 &#8211; Adding Drivers To Our Image PC</a></li>
<li><a href="http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-2-verifying-sysprep-and-driver-file-permissions/">SysPrep in Depth &#8211; Part 2 &#8211; Verifying SysPrep And Driver File Permissions</a></li>
<li><a href="http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-3-sysprepinf-and-hals/">SysPrep in Depth &#8211; Part 3 &#8211; SysPrep.inf and HALâ€™s</a></li>
<li><a href="http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-4-cleaning-up-unneeded-drivers/">SysPrep in Depth &#8211; Part 4 &#8211; Cleaning Up Unneeded Drivers</a></li>
<li><a href="http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-5-customizing-sysprepinf/">SysPrep in Depth &#8211; Part 5 &#8211; Customizing Sysprep.inf</a></li>
<li><a href="http://remyservices.wordpress.com/2008/01/24/sysprep-in-depth-part-5-addition-1-customizing-sysprepinf/">SysPrep in Depth &#8211; Part 5 addition 1 &#8211; Customizing Sysprep.inf</a></li>
<li><a href="http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-6-bringing-parts-1-5-together/">SysPrep in Depth &#8211; Part 6 &#8211; Bringing Parts 1-5 Together</a></li>
<li><a href="http://remyservices.wordpress.com/2007/10/26/sysprep-in-depth-part-7-obtaining-your-drivers/">SysPrep in Depth &#8211; Part 7 &#8211; Obtaining Your Hardware Drivers</a></li>
<li><a href="http://remyservices.wordpress.com/2007/11/17/sysprep-in-depth-part-8-automating-your-product-keys/">SysPrep in Depth &#8211; Part 8 &#8211; Automating your Product Keys</a></li>
</ul>
<p>And in case in the future something more will be added to the series, check out the <a href="http://www.google.de/search?q=site:remyservices.wordpress.com+sysprep+in+depth&#038;hl=en&#038;start=0&#038;sa=N">google link</a>.</p>
<p>Happy administering!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/04/virtualisation-vmware-sysprep-not-as-easy-as-it-seems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why 32768 isn&#8217;t always the same as 0&#215;8000</title>
		<link>http://www.bezem.de/2009/03/why-32768-ist-always-the-same-as-0x8000/</link>
		<comments>http://www.bezem.de/2009/03/why-32768-ist-always-the-same-as-0x8000/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 19:35:34 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[General development]]></category>
		<category><![CDATA[PC Lint / FlexeLint]]></category>
		<category><![CDATA[QAC]]></category>
		<category><![CDATA[Lint]]></category>
		<category><![CDATA[static syntax checking]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=226</guid>
		<description><![CDATA[Contrary to intuition, the C constants &#8217;32768&#8242; and &#8217;0&#215;8000&#8242; have an identical representation (0&#215;8000), but possibly different types in C. If you consider a processor with a 16-bit int type, and a 32-bit long type, 32768 is considered long, whereas 0&#215;8000 (and the octal variant 0100000) is considered &#8216;unsigned int&#8217;. If you feel the need, [...]]]></description>
			<content:encoded><![CDATA[<p>Contrary to intuition, the C constants &#8217;32768&#8242; and &#8217;0&#215;8000&#8242; have an<br />
identical representation (0&#215;8000), but possibly different types in C.<br />
If you consider  a processor with a 16-bit int type, and a 32-bit long<br />
type, 32768 is considered long, whereas 0&#215;8000 (and the octal variant<br />
0100000) is considered &#8216;unsigned int&#8217;.</p>
<p>If you feel the need, check the C standard at<br />
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf, page 55 at the<br />
bottom, and the table at page 56. (look at Harbison &amp; Steele, 5th edition, and look at section 2.7.1 page 24ff).</p>
<p>Normally, there is no problem when using such values, since the<br />
representations are identical.<br />
However, consider this small example:</p>
<pre>#define C_DECIMAL     32768
#define C_HEXADECIMAL 0x8000

void main(int argc, char *argv[])
{
  volatile long long_dec = ((long)~C_DECIMAL);
  volatile long long_hex = ((long)~C_HEXADECIMAL);

  return;
}</pre>
<p>When C_DECIMAL is considered long, the negation will invert 32 bits,<br />
resulting in a representation 0xFFFF7FFF with type &#8216;long&#8217;; the cast is<br />
superfluous.<br />
When C_HEXADECIMAL is considered &#8216;unsigned int&#8217;, the negation will invert<br />
16 bits, resulting in a representation 0x7FFF with type &#8216;unsigned int&#8217;;<br />
the cast will then zero-extend to a &#8216;long&#8217; value of 0x00007FFF.</p>
<p>Checking with a 16-bit integer compiler (CW7.1 ColdFire using &#8216;-intsize 2&#8242;):</p>
<pre>0x00000000                    _main:
;                             main:
0x00000000  0x4E560000               link     a6,#0
0x00000004  0x518F                   subq.l   #8,a7
0x00000006  0x223C<em>FFFF7FFF</em>           move.l   #-32769,d1
0x0000000C  0x2D41FFF8               move.l   d1,-8(a6)
0x00000010  0x223C<em>00007FFF</em>           move.l   #32767,d1
0x00000016  0x2D41FFFC               move.l   d1,-4(a6)
0x0000001A  0x4E5E                   unlk     a6
0x0000001C  0x4E75                   rts</pre>
<p>For those of you who do not know how to read assembler code I have made the differing values <em>italic</em>. So the compiler confirms the difference in behavior, and this is not a compiler error.</p>
<p>Lucky you if you have Lint to warn you. (Yes, I know, other tools will too, if you let them&#8230;)</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/03/why-32768-ist-always-the-same-as-0x8000/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use of in-line assembler using &#8216;asm&#8217; variants</title>
		<link>http://www.bezem.de/2009/03/use-of-in-line-assembler-using-asm-variants/</link>
		<comments>http://www.bezem.de/2009/03/use-of-in-line-assembler-using-asm-variants/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 16:38:54 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[PC Lint / FlexeLint]]></category>
		<category><![CDATA[Lint]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=212</guid>
		<description><![CDATA[Just a &#8220;small&#8221; post to expand on my most recent tweet. In-line assembler is quite a difficult topic, but unavoidable in most embedded environments. And the syntactic variants are more numerous than the bugs in your code. For that reason I give a piece of advice: For each different assembler semantic, use a different macro. [...]]]></description>
			<content:encoded><![CDATA[<p>Just a &#8220;small&#8221; post to expand on my <a href="http://twitter.com/LintTweets">most recent tweet</a>. In-line assembler is quite a difficult topic, but unavoidable in most embedded environments. And the syntactic variants are more numerous than the bugs in your code.</p>
<p>For that reason I give a piece of advice: For each different assembler semantic, use a different macro. For an assembler function, use <code>ASM_FN</code> like this:<br />
<code>ASM_FN int MyAssemblerFunction(void)<br />
{<br />
   ...assembler instructions...<br />
}<br />
</code>For an in-line assembler block, use <code>ASM_BLOCK</code> like this:<code><br />
  ...<br />
  a += 4;<br />
  ASM_BLOCK volatile {<br />
    ...assembler instructions...<br />
  };<br />
</code>And for single-line in-line assembler instructions use <code>ASM_LINE</code> like this:<code><br />
  ...<br />
  a += 4;<br />
  ASM_LINE movb ax,0b00000010;<br />
  ...<br />
</code>Now, all these uses will need to expand into the non-standard keyword <code>asm</code> for the compiler to process everything correctly. Many compilers accept different forms of the keyword, so you may use <code>asm</code>, <code>__asm</code> and <code>__asm__</code> interchangeably. If you want to, you can take these three variants instead of the <code>ASM_(FN|BLOCK|LINE)</code> as I suggested.</p>
<p>The idea is to enable Lint to expand each of these three forms differently: The function containing only assembler instructions shall be ignored by Lint, but its prototype needs to be known. Therefore we need to enable the Lint keyword <code>_ignore_init</code> (the body of the function is seen as a form of &#8220;initialization&#8221;), and provide the options:<code><br />
+rw(_ignore_init)<br />
+dASM_FN=_ignore_init<br />
</code>The plus-sign in the second option prevents the definition in our code (to <code>asm</code> or one its variants) to override the Lint-specific definition. However, for <code>ASM_BLOCK</code> this replacement will not work, so we need a different replacement:<code><br />
+rw(_up_to_brackets)<br />
+dASM_BLOCK=_up_to_brackets<br />
</code> And the third form again needs a different replacement, since in this case, no brackets need be present at all:<code><br />
+rw(_to_semi)<br />
+dASM_LINE=_to_semi<br />
</code>With some other form of in-line assembler definition you might even need <code>_to_eol</code>, or one of the other gobblers. But make sure to use different  macros for different syntactic usages of <code>asm</code>, so you have the chance to use different gobblers for all situations.</p>
<p>Happy Linting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/03/use-of-in-line-assembler-using-asm-variants/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitterfeed on PC Lint</title>
		<link>http://www.bezem.de/2009/02/twitterfeed-on-pc-lint/</link>
		<comments>http://www.bezem.de/2009/02/twitterfeed-on-pc-lint/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 18:40:27 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[PC Lint / FlexeLint]]></category>
		<category><![CDATA[Lint]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=209</guid>
		<description><![CDATA[I&#8217;m going to experiment a little with Twitter. I created a Twitter account called LintTweets, where I intend to collect some Lint wisdom in 140 characters. In some cases I may expand on those quite limited 140 characters in my blog here. You&#8217;re welcome to read here and/or follow me on Twitter. The frequency of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to experiment a little with Twitter. I created a Twitter account called <a href="https://twitter.com/LintTweets">LintTweets</a>, where I intend to collect some Lint wisdom in 140 characters. In some cases I may expand on those quite limited 140 characters in my blog here. You&#8217;re welcome to read here and/or follow me on Twitter. The frequency of my tweets there will probably not exceed once a week, so don&#8217;t expect too much.</p>
<p>Happy Linting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/02/twitterfeed-on-pc-lint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two new articles: Physical Architecture and Coding Conventions</title>
		<link>http://www.bezem.de/2009/02/two-new-articles-physical-architecture-and-coding-conventions/</link>
		<comments>http://www.bezem.de/2009/02/two-new-articles-physical-architecture-and-coding-conventions/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 19:45:52 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[General development]]></category>
		<category><![CDATA[HowTo]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=200</guid>
		<description><![CDATA[I just added two articles, again, the basics of which have been written some time ago, but now I revamped them and put them on the website. And since the number of articles (or: white papers) has grown, I have dedicated a new page to these &#8220;white papers&#8221;. I now express my opinion on physical [...]]]></description>
			<content:encoded><![CDATA[<p>I just added two articles, again, the basics of which have been written some time ago, but now I revamped them and put them on the website.<br />
And since the number of articles (or: white papers) has grown, I have dedicated a new page to these &#8220;white papers&#8221;.</p>
<p>I now express my opinion on physical architecture (in contrast to the logical software architecture everyone learns when trying to learn programming), and on the almost religious topic of coding conventions. Have a look at the new <a href="http://www.bezem.de/en/whitepapers/">white paper page</a>!</p>
<p>Johan</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/02/two-new-articles-physical-architecture-and-coding-conventions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New version of &#8220;How To Wield PC-Lint&#8221;</title>
		<link>http://www.bezem.de/2009/01/new-version-of-how-to-wield-pc-lint/</link>
		<comments>http://www.bezem.de/2009/01/new-version-of-how-to-wield-pc-lint/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 17:56:45 +0000</pubDate>
		<dc:creator>Johan Bezem</dc:creator>
				<category><![CDATA[PC Lint / FlexeLint]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Lint]]></category>

		<guid isPermaLink="false">http://www.bezem.de/?p=186</guid>
		<description><![CDATA[I finally got to adapt my document for the most recent Lint version 9.0b. I have replaced the original document, but if you just want to see where the changes have been incorporated, a version with change bars is available. Happy linting!]]></description>
			<content:encoded><![CDATA[<p>I finally got to adapt my document for the most recent Lint version 9.0b. I have replaced the <a href="http://www.bezem.de/pdf/htwpl.pdf">original document</a>, but if you just want to see where the changes have been incorporated, a <a href="http://www.bezem.de/pdf/htwpl_diff.pdf">version with change bars</a> is available.</p>
<p>Happy linting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bezem.de/2009/01/new-version-of-how-to-wield-pc-lint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
