TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How Many C Programs Are There?

34 pointsby primodemusabout 13 years ago

5 comments

dexenabout 13 years ago
There'd be a whole lot of programs.<p>There's a good reading that approaches a related subject, but isn't specific to <i>C</i> programs: <a href="http://www.scottaaronson.com/writings/bignumbers.html" rel="nofollow">http://www.scottaaronson.com/writings/bignumbers.html</a><p>In short, `busy beaver number' -- number of steps that a halting Turing machine with dictionary of size N can have -- grows pretty fast with N; faster than Ackermann function anyway.<p>Also, supposedly <i>a katamari is the only thing which outgrows the busy beaver sequence ;)</i> <a href="http://www.xamuel.com/katamari-damacy-growth/" rel="nofollow">http://www.xamuel.com/katamari-damacy-growth/</a>
评论 #3617976 未加载
bnegreveabout 13 years ago
&#62; <i>Anyway, I’d be interested to hear people’s thoughts on this</i><p>I would rather try to evaluate the size of the abstract syntax tree. I think this is more relevant since int main(){int a;} is obviously similar to int main(){int b;}
评论 #3617579 未加载
评论 #3617566 未加载
fragsworthabout 13 years ago
I think it would make more sense to start by looking at research done on grammars. For instance:<p><a href="http://www.cs.toronto.edu/~yuvalf/CFG-LB.pdf" rel="nofollow">http://www.cs.toronto.edu/~yuvalf/CFG-LB.pdf</a>
DaveInTucsonabout 13 years ago
<i>How many functionally inequivalent C programs are there?</i><p>Surely this is undecidable?
评论 #3618455 未加载
评论 #3617689 未加载
评论 #3617743 未加载
soldabout 13 years ago
If you have printf, then "printf("long string")" where the string might be modified should give a good bound, say Omega(200^S). If you don't have it, what is the program allowed to do? Only return from main, without checking arguments? Then you have as many extensionally distinct programs as integers.