Quantcast
Viewing all articles
Browse latest Browse all 24

Answer by Keith Randall for Generate the longest error message in C++

279 chars

#define A(s) s##s##s##s##s##s##s##s#define B(s) A(s##s##s##s##s##s##s##s)#define C(s) B(s##s##s##s##s##s##s##s)#define D(s) C(s##s##s##s##s##s##s##s)#define E(s) D(s##s##s##s##s##s##s##s)#define F(s) E(s##s##s##s##s##s##s##s)#define G(s) F(s##s##s##s##s##s##s##s)a G(foo)

With gcc 4.2.1, generates the error error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘foofoo....foofoo’ with 2^21 copies of foo. 6,291,558 bytes in all. It's about as big an identifier as I can get, replacing foo with food generates an ICE.


Viewing all articles
Browse latest Browse all 24

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>