"RE: "Re: "RE: Infinite loop ..." 
Author Message
 "RE: "Re: "RE: Infinite loop ..."

In article 20468 Lars Rasmussen writes:

=>In article 20435 Rama R. Pakala writes:
=>`> main(i){while(22-printf("\n%d little %s",i++,i%3?i>9?"indian boys":"":"indians"));}
=>`>
=>`> Note, that this is 83-char NON-OBFUSCATED CODE. If you allow me to
=>`> obfuscate, I'll join the "indian" chars... O.K. ?
=I came to wonder what your definition of obfuscation is.
=Surely the use of ??::, 22-printf(.. and the declaration of the variable i
=in the example above ranks as obfuscation???
=

Obfuscation, Lars, is when you're FLUENT IN C, I give you SELF-CONTAINED
C source code, and you look at it and SCRATCH OUR HEAD like a child :-)

O.K. ?

I can give you such code, if you're not going to feel humiliated :-(

=>`>
=>`> ZAR Petkov
=>`
=>`When I compiled this and ran it on my NeXT using the gnu compiler, I got
=>`into an infinite loop :-))
=>`
=>It depends on the implemenatation of the "printf" on your compiler:
=
=>DOES printf RETURN-VALUE COUNT the \n as a char or NOT:
=>Borland C++ DOES - that's why I have put
=
=>main(i){while(22-printf...
=
=>If your compiler DOES NOT count the "\n" as a char, put
=>main(i){while(21-printf...
=
=Which hardly makes the entry portable ;)
=So that's two portability-problems in your code. (including i++ in the call)

=--

Lars, if you consider "++" and "printf" non-portable for the contest, then
you have to become a lawer :-)

Make it a great day:

ZAR Petkov

__


phone (412) 241-0862
Pittsburgh, PA



Mon, 28 Aug 1995 22:57:21 GMT  
 "RE: "Re: "RE: Infinite loop ..."

Quote:
>In article 20468 Lars Rasmussen writes:
>=>In article 20435 Rama R. Pakala writes:
>=>`> main(i){while(22-printf("\n%d little %s",i++,i%3?i>9?"indian boys":"":"indians"));}
>=>`> Note, that this is 83-char NON-OBFUSCATED CODE. If you allow me to
>=>`> obfuscate, I'll join the "indian" chars... O.K. ?
>=I came to wonder what your definition of obfuscation is.
>=Surely the use of ??::, 22-printf(.. and the declaration of the variable i
>=in the example above ranks as obfuscation???
>Obfuscation, Lars, is when you're FLUENT IN C, I give you SELF-CONTAINED
>C source code, and you look at it and SCRATCH OUR HEAD like a child :-)

Not really having used the return-value from printf for anything and not
re-reading the printf-manual every so often, I _did_ scratch my head for a
while over the 22-printf(..  :)
I guess my definition of obfuscation is more moderate than yours then.

Quote:
>I can give you such code, if you're not going to feel humiliated :-(

Heh. Nah, I'm familiar with some gross examples ;)

Quote:
>=>DOES printf RETURN-VALUE COUNT the \n as a char or NOT:
>=>Borland C++ DOES - that's why I have put
>=
>=>main(i){while(22-printf...
>=
>=>If your compiler DOES NOT count the "\n" as a char, put
>=>main(i){while(21-printf...
>=
>=Which hardly makes the entry portable ;)
>=So that's two portability-problems in your code. (including i++ in the call)
>Lars, if you consider "++" and "printf" non-portable for the contest, then
>you have to become a lawer :-)

Ungh. It's much more fun finding loopholes in OS's than in dusty lawbooks ;)

Maybe I wasn't clear enough:
A solution having any of the two following 'features' will probably compile
correctly with an ansi-compliant compiler, but the excact behaviour of the
executable will be strongly dependant on the architecture.

1) Increment the variable in the argument list of printf()

   From the Ansi-Reference Manual (in K&R):
     A7.3.2 Function Calls
     [...]
       The order of evaluation of arguments is unspecified; take note that
     various compilers differ.
     [...]

2) Rely on the excact value returned from printf()
   (Ie: 22-printf() or 3&printf().)

   You pointed at the problem with this yourself.

Quote:
>Make it a great day:
>ZAR Petkov
>__

>phone (412) 241-0862
>Pittsburgh, PA

Regards,
--



Tue, 29 Aug 1995 21:25:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. remove() vrs fopen("""w")

2. Displaying binary data as ascii "1"'s and "0"'s

3. Looking for "Shroud"/"Obfus"

4. ""help with TSR""

5. Parse trees and "("")"

6. Error "free"-ing "malloc"-ed memory

7. Displaying binary data as ascii "1"'s and "0"'s

8. Loop or Loops in "C"

9. List View Control "Infinite" Scroll

10. Attention "C"/"C++" gurus and "C" newbees

11. merits of "#define", "const", and "enum" ???

12. why not "cout", "<<" , and "endl"??

 

 
Powered by phpBB® Forum Software