Questions tagged [compile-time]
For challenges involving doing something at compile-time, rather than run-time. This means that only compiled languages can compete.
13
questions
9
votes
5
answers
838
views
Peano arithmetic at compile time
Peano numbers represent nonnegative integers as zero or successors of other Peano numbers. For example, 1 would be represented as Succ(Zero) and 3 would be ...
27
votes
1
answer
2k
views
Program that compiles into itself
We've had lots of questions about quines, programs where the source code and output are identical. For compiled languages, there are other combinations: we've already had a question about writing a ...
10
votes
3
answers
633
views
Interpreted arithmetic
A little known fact is that if you turn on enough language extensions (ghc) Haskell becomes a dynamically typed interpreted language! For example the following program implements addition.
...
-4
votes
8
answers
667
views
"Hello, World", Even before it runs
Warning: This challenge is only valid for languages with a compiler.
Make a program (which is perfectly valid code) that outputs Hello, World, even before runtime.
...
154
votes
28
answers
20k
views
Shortest Code to Legitimately Slack Off
I'm a developer, and I don't feel like doing my work. I know from XKCD that the best excuse for slacking off is that your code's compiling. Because of this, I think I need some code that will compile ...
0
votes
4
answers
800
views
Enhanced Builder Pattern, verified at compile time [closed]
Question: can you design a Builder Pattern API which verifies at compile time that every field is set exactly once?
To be eligible, the size of the compiler output should not be exponential in the ...
431
votes
23
answers
149k
views
Build a Compiler Bomb
Introduction
You're probably familiar with zip bombs, XML bombs, etc. Put simply, they are (relatively) small files which produce enormous output when interpreted by naïve software. The challenge ...
51
votes
8
answers
7k
views
1 character typo generating most error messages from C++ compilation
It seems that simple changes to a C++ file, especially with templates, can generate pages of errors. This contest is to see what the largest "bang of the buck" is, that is the more verbose error ...
20
votes
6
answers
1k
views
Bloatware contest: producing 100+ MiB executable [closed]
Create short source code in your favourite compiled language that compiles into a big (not less than 104857600 bytes) executable file. The program must be runnable (assuming 1GB of free memory) and ...
2
votes
1
answer
559
views
Generate numerical permutations with conditions and template metaprogramming [closed]
This, but via template metaprogramming:
template <int n> struct insanity { int[][n] permutations; }
Generate all numbers with n digits (0-9) such that each ...
46
votes
26
answers
8k
views
Crash your favorite compiler [closed]
Write a perfectly legal code in a decent language of your choice whose compiling will either crash the compiler or send it into an infinite loop (infinite compile time).
Restrictions:
Use a standard ...
17
votes
8
answers
11k
views
Compute the CRC32 table at compile-time [closed]
The reference implementation of CRC32 computes a lookup table at runtime:
...
40
votes
5
answers
8k
views
Solve the eight queens problem at compile-time [closed]
Can you solve the eight queens puzzle at compile-time?
Pick any suitable output format.
I'm particularly interested in a C++ template metaprogramming solution, but you can use languages that have ...