<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: The Smallest Program</title>
	<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/</link>
	<description>Structural and Behavioral Patterns for Software Diagnostics, Forensics and Prognostics</description>
	<pubDate>Wed, 06 May 2026 06:07:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: CyberRax</title>
		<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-117493</link>
		<dc:creator>CyberRax</dc:creator>
		<pubDate>Mon, 18 Jan 2010 06:37:18 +0000</pubDate>
		<guid>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-117493</guid>
		<description>Actually they are of the same size: 0 bytes. The problem is that they depend on what's already in the memory. In your case it's a bunch of zeoes which cause a crash. But this value depends on the OS. Vanilla DOS doesn't really clear memory so if the segment where the program is loaded already contains a RET at 100h then it'll work.
The RET command actually also depends on the environment. A correct program would be 2 bytes long, containing "INT 20h" (EXIT in DOS 1, but also supported by later versios, altough using INT 21h with the "exit" value is prefferred). Your current implementation depends on the correct value being in the stack, which IIRC is not always the case.</description>
		<content:encoded><![CDATA[<p>Actually they are of the same size: 0 bytes. The problem is that they depend on what&#8217;s already in the memory. In your case it&#8217;s a bunch of zeoes which cause a crash. But this value depends on the OS. Vanilla DOS doesn&#8217;t really clear memory so if the segment where the program is loaded already contains a RET at 100h then it&#8217;ll work.<br />
The RET command actually also depends on the environment. A correct program would be 2 bytes long, containing &#8220;INT 20h&#8221; (EXIT in DOS 1, but also supported by later versios, altough using INT 21h with the &#8220;exit&#8221; value is prefferred). Your current implementation depends on the correct value being in the stack, which IIRC is not always the case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crash Dump Analysis &#187; Blog Archive &#187; Opcodism: The Art of Opcodes</title>
		<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-96472</link>
		<dc:creator>Crash Dump Analysis &#187; Blog Archive &#187; Opcodism: The Art of Opcodes</dc:creator>
		<pubDate>Mon, 28 Sep 2009 16:22:49 +0000</pubDate>
		<guid>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-96472</guid>
		<description>[...] The earliest opcodism binary was created on October 25th, 2006 that I now call Nothingness and Crash: The Smallest Program. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] The earliest opcodism binary was created on October 25th, 2006 that I now call Nothingness and Crash: The Smallest Program. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hught</title>
		<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-15</link>
		<dc:creator>hught</dc:creator>
		<pubDate>Mon, 30 Oct 2006 06:50:51 +0000</pubDate>
		<guid>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-15</guid>
		<description>I saw it done many years ago with Fortran IV, AlgolW and BCPL. It was extremely devious and involved lines such as

COMMENT = 3;

which in Fortran is a comment (capital C in column 6) and is a variable assignment in the other two. There was generally much abuse of the comment facility to hide things and everything was in capitals. I think I'm showing my age</description>
		<content:encoded><![CDATA[<p>I saw it done many years ago with Fortran IV, AlgolW and BCPL. It was extremely devious and involved lines such as</p>
<p>COMMENT = 3;</p>
<p>which in Fortran is a comment (capital C in column 6) and is a variable assignment in the other two. There was generally much abuse of the comment facility to hide things and everything was in capitals. I think I&#8217;m showing my age</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry Vostokov</title>
		<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-14</link>
		<dc:creator>Dmitry Vostokov</dc:creator>
		<pubDate>Fri, 27 Oct 2006 09:57:05 +0000</pubDate>
		<guid>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-14</guid>
		<description>Here is the program written in Visual C++ and C# and compiles under both compilers. When compiled as C# by C# compiler it prints "Written in C#". When compiled under Visual C++ compiler it prints nothing because there is not need to say that C++ is the best language ever

#if !__cplusplus
class Program
{
static void Main()
{
System.Console.WriteLine("Written in C#");
}
}
#else
void main() {}
#endif</description>
		<content:encoded><![CDATA[<p>Here is the program written in Visual C++ and C# and compiles under both compilers. When compiled as C# by C# compiler it prints &#8220;Written in C#&#8221;. When compiled under Visual C++ compiler it prints nothing because there is not need to say that C++ is the best language ever</p>
<p>#if !__cplusplus<br />
class Program<br />
{<br />
static void Main()<br />
{<br />
System.Console.WriteLine(&#8221;Written in C#&#8221;);<br />
}<br />
}<br />
#else<br />
void main() {}<br />
#endif</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry Vostokov</title>
		<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-13</link>
		<dc:creator>Dmitry Vostokov</dc:creator>
		<pubDate>Fri, 27 Oct 2006 05:48:05 +0000</pubDate>
		<guid>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-13</guid>
		<description>Cool challenge! Reminds me Obfuscated C Code contests. I devised this algorithm in pseudo code (might require a supercomputer if we assess its complexity for a non trivial program that prints a language it is written in ):
main()
{
input max_length;
test("", 0, max_length);
}

bool test(string prg, int level, int max)
{
if (level == max) return false;
for (char in [allowed symbols for both languages])
{
prg += char;
if (both compilers compile successfully) { print prg; return true; }

if (test(prg, level+1, max) == true) return true;
prg -= char;
}
return false;
}
I'll try to implement it in C and let you know Although you have to wait for about 2*10,000,000,000 compilations in the worst case for simple languages (10 letters in alphabet and the length of the program is 10 symbols) because the complexity is O(N^M) where N is alphabet cardinality and M is the maximum program length to try</description>
		<content:encoded><![CDATA[<p>Cool challenge! Reminds me Obfuscated C Code contests. I devised this algorithm in pseudo code (might require a supercomputer if we assess its complexity for a non trivial program that prints a language it is written in ):<br />
main()<br />
{<br />
input max_length;<br />
test(&#8221;", 0, max_length);<br />
}</p>
<p>bool test(string prg, int level, int max)<br />
{<br />
if (level == max) return false;<br />
for (char in [allowed symbols for both languages])<br />
{<br />
prg += char;<br />
if (both compilers compile successfully) { print prg; return true; }</p>
<p>if (test(prg, level+1, max) == true) return true;<br />
prg -= char;<br />
}<br />
return false;<br />
}<br />
I&#8217;ll try to implement it in C and let you know Although you have to wait for about 2*10,000,000,000 compilations in the worst case for simple languages (10 letters in alphabet and the length of the program is 10 symbols) because the complexity is O(N^M) where N is alphabet cardinality and M is the maximum program length to try</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hught</title>
		<link>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-12</link>
		<dc:creator>hught</dc:creator>
		<pubDate>Fri, 27 Oct 2006 05:20:44 +0000</pubDate>
		<guid>https://www.dumpanalysis.org/blog/index.php/2006/10/25/the-smallest-program/#comment-12</guid>
		<description>Cool. So here's a challenge: write a program that is in multiple languages - that is, it will successfully compile under two or more different language compilers, and will run without causing an error. Ideally, when run, it should do something smart like print the name of the language it was compiled as.

I have seen this done before - the same piece of code compiled under three different language compilers.

There's a pint offered for the best solution</description>
		<content:encoded><![CDATA[<p>Cool. So here&#8217;s a challenge: write a program that is in multiple languages - that is, it will successfully compile under two or more different language compilers, and will run without causing an error. Ideally, when run, it should do something smart like print the name of the language it was compiled as.</p>
<p>I have seen this done before - the same piece of code compiled under three different language compilers.</p>
<p>There&#8217;s a pint offered for the best solution</p>
]]></content:encoded>
	</item>
</channel>
</rss>
