Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: net.lang Subject: Re: Cute little liar program (for hackers only) Message-ID: <993@ttrdc.UUCP> Date: Fri, 20-Jun-86 20:43:26 EDT Article-I.D.: ttrdc.993 Posted: Fri Jun 20 20:43:26 1986 Date-Received: Sat, 21-Jun-86 13:15:55 EDT References: <7772@watdaisy.UUCP> <605@ittvax.ATC.ITT.UUCP> <722@mit-trillian.MIT.EDU> Distribution: net Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 53 Keywords: C pascal hack In article <722@mit-trillian.MIT.EDU>, wesommer@mit-trillian.MIT.EDU (William Sommerfeld) writes: >This one works a little better; it doesn't complain when compiled by the >Pascal compiler (at least under 4.3BSD) >Tricks: > - { } is a comment in Pascal, statement delimeters in C. > - /*) and (*/ to toggle between 'C' and Pascal. > - The only reason to have the #define openbrace in there is so >that the Pascal compiler doesn't give you a warning about having an >open brace character in the middle of a comment. >Anyone want to work on some more obscure ones??? > Bill Sommerfeld > ARPA: wesommer@athena.mit.edu > UUCP: mit-eddie!wesommer (forwards) >(*foo); >#define openbrace { >/*) >program main(output); >begin > writeln('I was compiled by a Pascal compiler.'); >end. >{*/ >main() >openbrace > puts("I was compiled by a C compiler"); >} Good show. Can anyone write one of these which combines Pascal, C, AND Fortran-77? I tried to do this but kept running into a situation where I needed a #define, which must be on the first character of a line (Fortran doesn't like that one bit since its comments are determined by the first character of each line). Oh yes, Fortran-77 considers '*', 'c', and 'C' all to be valid comment characters (begin a comment line by being in column 1), if that's any help (also a completely "blank" [columns 1-72] line is considered to be a comment). It's trivial to do a C/Fortran combination, however: main(){printf("I was compiled by a C compiler\n"); /* [starts in column 73] C ^ C | C Column 73 C | C v write(*,*)'I was compiled by a Fortran compiler' */ -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, vax135}!ttrdc!levy