<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Portability Blog (Entries tagged as windows)</title>
    <link>http://portabilityblog.com/blog/</link>
    <description>tales about building software on many platforms</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.2.1 - http://www.s9y.org/</generator>
    <managingEditor>df.portabilityblog@erinye.com</managingEditor>
<webMaster>df.portabilityblog@erinye.com</webMaster>
<pubDate>Wed, 23 Jun 2010 06:34:21 GMT</pubDate>

    <image>
        <url>http://portabilityblog.com/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Portability Blog - tales about building software on many platforms</title>
        <link>http://portabilityblog.com/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Perl exec</title>
    <link>http://portabilityblog.com/blog/archives/12-Perl-exec.html</link>
            <category>Compilers</category>
            <category>Operating Systems</category>
    
    <comments>http://portabilityblog.com/blog/archives/12-Perl-exec.html#comments</comments>
    <wfw:comment>http://portabilityblog.com/blog/wfwcomment.php?cid=12</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://portabilityblog.com/blog/rss.php?version=2.0&amp;type=comments&amp;cid=12</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Fischer)</author>
    <content:encoded>
    Perl is a popular scripting language in the UNIX world, and there are several ports available for Windows. If your UNIX project uses perl, then porting that code to Windows is fairly painless. Perl doesn&#039;t attempt to be entirely portable, but most of the differences are quite obvious.&lt;br /&gt;
&lt;br /&gt;
One that is apparently not obvious is perl&#039;s exec function. I&#039;ve seen this happen to two different projects recently, in short succession. The symptom was that a process was started by a perl script, but no output from it was recorded on Windows. On UNIX, everything worked as expected.&lt;br /&gt;
&lt;br /&gt;
This turns out to be not very complicated. On UNIX, exec is implemented in terms of the execl()/execv() family of syscalls. This means the child process replaces the parent, and any process waiting for that parent automatically waits for the child instead. On Windows, there is no such thing. Windows perl implements exec by spawning a child process and returning control to the parent immediately, which then exits. Any process waiting for the parent regains control instantly and is left unaware of the child. A script written for UNIX will assume that the work is done before it has even started.&lt;br /&gt;
&lt;br /&gt;
There is a simple workaround: Use system (plus exit, if necessary) instead of exec. While the semantics are slightly different from exec, they are at least the same on both platforms; system spawns a new process and then waits for it, returning its exit code. Notice that system has a list form too so you don&#039;t need to worry about shell escaping either. 
    </content:encoded>

    <pubDate>Wed, 23 Jun 2010 08:34:21 +0200</pubDate>
    <guid isPermaLink="false">http://portabilityblog.com/blog/archives/12-guid.html</guid>
    <category>perl</category>
<category>unix</category>
<category>windows</category>

</item>
<item>
    <title>Version Number Formatting</title>
    <link>http://portabilityblog.com/blog/archives/9-Version-Number-Formatting.html</link>
            <category>Operating Systems</category>
    
    <comments>http://portabilityblog.com/blog/archives/9-Version-Number-Formatting.html#comments</comments>
    <wfw:comment>http://portabilityblog.com/blog/wfwcomment.php?cid=9</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://portabilityblog.com/blog/rss.php?version=2.0&amp;type=comments&amp;cid=9</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Fischer)</author>
    <content:encoded>
    One thing that&#039;s biting me currently is imposed version number formatting. The product I&#039;m working on uses the traditional Major-Minor-Patch format, that is, there are three numerical components in a version number. Additionally, we add a suffix for special builds based on a previous release, such as a single letter for a hotfix build, or a service pack identifier, or a support ticket identifier.&lt;br /&gt;
&lt;br /&gt;
Getting software certified for Windows Vista necessitates including a manifest with the software that, among other information, contains the name of the executable, the version number, security settings, and a signature. The version number consists of four components: Major, minor, build and revision. The version number goes into an XML attribute, so one programmer apparently forgot to double-check and put in our regular three-component version number.&lt;br /&gt;
&lt;br /&gt;
Needless to say, we figured that out fairly fast, since Windows 2003 will refuse to run applications with embedded manifests that contain errors. Interestingly, the tool that actually embeds the manifest doesn&#039;t comment at all. And the error that you get from Windows is not very transparent - you have to look into the system event log to get a clue, and unless you&#039;re on Vista, the clue you&#039;re getting is only that there&#039;s &lt;i&gt;something&lt;/i&gt; wrong with your manifest. Anyway, we just added a zero as the fourth component and all was well.&lt;br /&gt;
&lt;br /&gt;
Over time, we started to use an 1 instead of a 0 as the fourth component for a revision based on a previous release.&lt;br /&gt;
&lt;br /&gt;
Some time later, we figured out that we actually have multiple different types of revisions. So now, the fourth component is calculated from all of them (or, all of those that we thought of, so far). It&#039;s starting to look like a bit field. Of course, the &quot;revision&quot; field is completely meaningless for comparison purposes: Revision 100 is based on completely different changes to the source code than Revision 1. Granted, you can still tell from revision 101 that it includes both sets of updates, but at this point I&#039;m just glad that our other platforms aren&#039;t as limiting. 
    </content:encoded>

    <pubDate>Fri, 18 Jan 2008 12:01:51 +0100</pubDate>
    <guid isPermaLink="false">http://portabilityblog.com/blog/archives/9-guid.html</guid>
    <category>vista</category>
<category>windows</category>

</item>
<item>
    <title>sizeof(long)</title>
    <link>http://portabilityblog.com/blog/archives/3-sizeoflong.html</link>
            <category>Compilers</category>
    
    <comments>http://portabilityblog.com/blog/archives/3-sizeoflong.html#comments</comments>
    <wfw:comment>http://portabilityblog.com/blog/wfwcomment.php?cid=3</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://portabilityblog.com/blog/rss.php?version=2.0&amp;type=comments&amp;cid=3</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Fischer)</author>
    <content:encoded>
    It should be an offense to rely on the size of a given type in C to be the same across different platforms. Still, certain assumptions appear to be fairly common. One of them is the value of sizeof(long). I think we&#039;ve gotten over the idea that long and int are the same size now that 64 bit platforms are becoming more and more common. However, occassionally I still encounter a similar misconception: That the sizes of long and any pointer type are the same.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;font-size:9pt;&quot;&gt;&lt;span style=&quot;color:#808080&quot;&gt; 1 &lt;/span&gt;&lt;span style=&quot;color:#733710&quot;&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 2 &lt;/span&gt;&lt;span style=&quot;color:#733710&quot;&gt;#define S(X) printf(#X&lt;/span&gt; &lt;span style=&quot;color:#733710&quot;&gt;&amp;quot; %d&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color:#733710&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color:#733710&quot;&gt;, sizeof(X))&lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 3 &lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 4 &lt;/span&gt;&lt;span style=&quot;color:#8f0055&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;() {&lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 5 &lt;/span&gt;  &lt;span style=&quot;color:#000000&quot;&gt;S&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#8f0055&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;*);&lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 6 &lt;/span&gt;  &lt;span style=&quot;color:#000000&quot;&gt;S&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#8f0055&quot;&gt;long&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;);&lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 7 &lt;/span&gt;  &lt;span style=&quot;color:#8f0055&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color:#2300ff&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color:#808080&quot;&gt; 8 &lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This snippet will tell you that both a long and a pointer to int are of size 4 on most 32 bit platforms, and that both are of size 8 on most 64 bit platforms. There is one notable platform where this isn&#039;t the case. When compiled with Visual Studio&#039;s cl.exe on 64 bit Windows, the size of the pointer will be 8, but the size of the long will be 4.&lt;br /&gt;
&lt;br /&gt;
According to the C standard, this is perfectly legal. In reality, I&#039;ve seen variables of type long used to store pointers, or anything else that fits into a long on one of the other platforms. Please stop doing that, it&#039;s wrong, and it will break on Windows. 
    </content:encoded>

    <pubDate>Sun, 16 Dec 2007 11:00:00 +0100</pubDate>
    <guid isPermaLink="false">http://portabilityblog.com/blog/archives/3-guid.html</guid>
    <category>64 bit</category>
<category>visual studio</category>
<category>windows</category>

</item>

</channel>
</rss>