[comp.lang.c] Portability and palindromes

hoey@nrl-aic.arpa (Dan Hoey) (01/08/87)

This argument about portability is all confusion between two usages of
the word.  I was speaking of ``formal'' portability, which is
determined by conformance to standards, as opposed to ``pragmatic''
portability, which is determined by the implementations under which a
given program will operate correctly.  Mark Crispin's anecdote
addresses only pragmatic portability, and Robbert van Renesse's belief
in the portability of ASCII coding is presumably based on the pragmatic
consideration that non-ASCII machines are fairly rare.

But my cavil about portability was tongue in cheek; perhaps less
obviously than on 31 August 1984* when I accused the writers of
self-reproducing programs that operate by reading their source files of
ignoring the purpose of self-reproducing programs, ``to be a backup, in
case the source is lost.''  The real reason I oppose turning numbers
into characters and reading source files is that I am intrigued by the
quotational problems inherent in automatic programs, and these tricks
sidestep the issue.

For your amusement, here is a 261-character automatic palindrome
(without newlines) and a 277-character one (with newlines).
================================================================
/**/char q='"',*a="*//**/char q='%c',*a=%c%s%c*/};)]d-062[b=]d[b(
rahctup)--d(elihw;)q,a,q,q,2+a,b(ftnirps{)(niam;162=d tni;]162[b,"
,b[261];int d=261;main(){sprintf(b,a+2,q,q,a,q);while(d--)putchar
(b[d]=b[260-d]);}/*c%s%c%=a*,'c%'=q rahc/**//*"=a*,'"'=q rahc/**/
================================================================

/**/char q='"',*a="*//**/char q='%c',*a=%c%s%c*/};)b(stup;]d[b=]d-472
[b)--d(elihw;)q,a,q,q,2+a,b(ftnirps;)b(stup{)(niam;731=d tni;]572[b,"
,b[275];int d=137;main(){puts(b);sprintf(b,a+2,q,q,a,q);while(d--)b[
274-d]=b[d];puts(b);}/*c%s%c%=a*,'c%'=q rahc/**//*"=a*,'"'=q rahc/**/
================================================================
As before, extra newlines have been added to the programs to send them
through the mail.  By the way, all of these programs have lines
hundreds of characters long.  Does anyone know if line length is
addressed by the long-forthcoming C standard?  I am considering
producing some short-line versions, but I don't know what length, if
any, is guaranteed by the standard.

Dan Hoey
1U23R11R'''1U23R11R'''
----------------
*In that note to this group, I also included some short automatic
programs and the palindrome ``/**/main(){}/*/}{)(niam/**/'' that
Robbert van Renesse recently rediscovered.  If you would like a copy of
the message, send mail to "HOEY@NRL-AIC.ARPA" on the Internet; UUCP
readers should use "...!seismo!HOEY@NRL-AIC.ARPA".  Be careful not to
send your request to the newsgroup.