This is my Merry Christmas contribution for all of you. First I wanted to post it to the poetry section. It is our beloved Christmas poem since 1988. If you have problems copy-pasting it, download it directly.
Trivia: run this program in three (3) different programming languages, and get three slightly different output!
#include#define q char w=0,v[]= q("@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+,/+#n+" ",/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;q#'r}eK" "K#}w'r}eKK{nl]'/#;#q#n'>{>#}w'>{>{nl]'/+#n';d}rw' i;# >{nl]!/n{n#'; r{#w'" "r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; " ":{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}" "+;#'rdq#w! nr'/ '> }+}{rl#'{n' '># }'+}##-[w]*%n+r3#l" #define mysweetdiego ",{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}int main #define cmp(s) (int t,char**_){struct w{int v;};if(sizeof(w)>1){v[111]='d'; #define cos(u) (137)v[112]='n',v[113]=';',v[114]=':';}return!f(t,_?0:0,0);} dducfirstde lt s ici length mysweetdiego cmp(s ror study biconverge and s l lleg and s fd fdo do reverse foo xor s go dog chr reverse ord srand hyperge and s eselcfirstexesee)if cos(s e e q dISWcJyccBWXJKcjBTocVUFEYcCUJWcDooYLW cWLoUccIEYVcTNTVLPyTcoPooQVXcLcRooVEYmTTTNTcLPREcocWoPYCcnQFKHCocEhcVMcooQt ctUPcAWWKroCoBLcPcLcAlUToCbcWoTLVYNoREcLcToctYzoooTcoKocMcUTCKJoCDUUocVMURI gMLSahOXDTcococaAQAoCKBcQoocozfkIITnPikugLocvccCoBGYiTTPcXcoimVuIDfavHlKHVX cokTPUooKgUYVoXVVxSjIAPmKUNbuocoPcBcYXUcVPkcoTcocVbPHoQTUOGxufBooTcmBFoVKPY loFcccXcoDmcvIOMMDOGmSBQovoTTBolPycPAoVVnKUIItTwBnYroocTTVccoKCcVoKlocrIrCf SBzgCocDJQRcccoVVzcQCUBxpioOLMsYZYucYoTTjWCoVoYHPTcBbxjoriLxGkaQcccycccLTTl UcNTBocoVUtuINkOxXCGOYvccJcCcUoobccLYroTcJtoooTtococzoEngovuncDNgooctcoOLXV mVmZoTCETcYoARclVQBTVoQoLcYHVcmkjhFjOfoWTocPVmoocWoLoccJMLYWOLsMBvFiMZIHXNo VochoRcTooJooCoLWuskMhhgIKPTooocZZocXTTYoqcoWWaKSqmCgZoPVmWcVcQokUTWotoNXWP uGvIqPaowkBocXcoTToLToooVVIcoqAnzzhigoTVohVVoUUQoBAcpccPooMVoGToDYQqqppyIjp NoVXScXUFovKoocUbLcVQTWNgbuHtioHsTocoRccoGcTXoocKTVocjgEpHDBloWcoEVVoHoocDc goUoWTVVTcEYBPnKpaoIFVVVXAcHbcoTocoAVTNTToftfXPmiiOopuaoVXccooUjcoocUcJUkTN cTFEXuVVmoUlWorTccoloGcTBoPooLcUlKoUcoXoYokocaAooTgPqTYLmcwJoVXocvmtJCjpcEo TTOorccVococoMoocTErPcVocqYEcVQoYcccocoKvoooQKuYcoQoloECoWojooQoofocWRooJLc coojOIQcWohrdemix)
Strict C compilers (tendra in default mode, gcc with -pedantic-errors) refuse to compile this, because while char v[]="..."; is valid, char v[]=("..."); is not. I haven't yet figured out what the third language is, if you don't mean C++, so I'm not sure if this breaks that, but my simple suggestion to resolve this is:
Instead of
#define q char w=0,v[]=
you can use
#define q(x) char w=0,v[]=x
It doesn't affect the output with less strict C compilers (gcc in default mode, icc), nor does it affect the output as a Perl script.
HTH
Update: I see now that the output is different when compiled as C++ instead of C ("only" instead of "true"), so it must be that that was what you meant.
I'm quite sure that it is not possible to add PostScript, because there is no way to find a common starting for C, C++, Perl, plain TeX and PostScript.
I took that as a challenge :D
%:/*:if 0;false +s&&(#*/include/* { Just another \TeX\ hacker, { \bye } &g;print substr q q Just another Perl hacker, q, 1 and exit; q q %};};);echo -ne "\e[A\e[K\ Just another bash hacker, " && exit; */ int main() { printf("\ Just another C%s hacker,\n\ ", "++"+2*(1%sizeof'2')); } /* } /Times-Roman findfont 20 scalefont setfont newpath 72 72 moveto (Just another PostScript hacker,) show showpage % q # */
%:/*:if 0;false +s &&(#*/include/* { \egroup\expandafter\ifx\csname documentclass\endcsname\relax \else \documentclass{article}\begin{document} Just another \LaTeX\ hacker, \csname fi\endcsname \end{document} \fi Just another \TeX\ hacker, { \egroup\end } &g;print substr q q Just another Perl hacker, q, 1 and exit; q q " (";}) awk 'BEGIN{printf"%c[A%c[K",27,27 }';sh=sh;test $BASH_VERSION&&sh=bash test $ZSH_VERSION&&sh=zsh echo Just another $sh hacker, && exit; */ int main() { return 0*printf("\ Just another C%s hacker,\n\ ", "++"+2*(1%sizeof'2')); } /* } /Times-Roman findfont 20 scalefont setfont newpath 72 72 moveto (Just another PostScript hacker,) show showpage % q # */
You may view the original node and the consideration vote tally.
You may view the original node and the consideration vote tally.
You may view the original node and the consideration vote tally.
perlmonks.org content © perlmonks.org and Anonymous Monk, blazar, Errto, NodeReaper, truedfx, zentara
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03