[NetBehaviour] How to display code-based art...
james morris
james at jwm-art.net
Mon Sep 7 23:14:09 CEST 2009
try this just to see what is happening:
--------8<------------
#include<stdio.h>
int main()
{
int i;
for(i=0;i <= 999999999;i++){
printf("i1:%d\n",i);
for(i=0;i <= 999999999;i++){
printf("i2:%d\n",i);
for(i=0;i <= 999999999;i++){
printf("i3:%d\n",i);
for(i=0;i <= 999999999;i++){
printf("i3:%d\n",i);
for(i=0;i <= 999999999;i++){
printf("i3:%d\n",i);
for(i=0;i <= 999999999;i++){
}
}
}
}
}
}
return 0;
}
--------8<------------
so what you actually wanted was:
--------8<------------
#include<stdio.h>
int main()
{
int i;
for(i=0;i <= 999999999;i++){
int i;
for(i=0;i <= 999999999;i++){
int i;
for(i=0;i <= 999999999;i++){
int i;
for(i=0;i <= 999999999;i++){
int i;
for(i=0;i <= 999999999;i++){
int i;
for(i=0;i <= 999999999;i++){
printf("Hello World");
}
}
}
}
}
}
return 0;
}
--------8<------------
which still does not result in any size difference!
james.
On 7/9/2009, "Pall Thayer" <pallthay at gmail.com> wrote:
>I don't know what I'm doing wrong but I'm not seeing a size difference
>in these two compilations:
>
>gcc -funroll-loops infinite.c -o infinite
>gcc infinite.c -o infinite2
>
>of this code:
>
>#include<stdio.h>
>
>main()
>{
> int i;
> for(i=0;i <= 999999999;i++){
> for(i=0;i <= 999999999;i++){
> for(i=0;i <= 999999999;i++){
> for(i=0;i <= 999999999;i++){
> for(i=0;i <= 999999999;i++){
> for(i=0;i <= 999999999;i++){
> printf("Hello World");
> }
>
> }
>
> }
>
> }
>
> }
>
> }
>
>}
>
>
>On Mon, Sep 7, 2009 at 6:37 PM, james morris<james at jwm-art.net> wrote:
>>
>> On 7/9/2009, "Pall Thayer" <pallthay at gmail.com> wrote:
>>
>>>What exactly happens when you try to unroll an infinite loop?
>>
>> http://en.wikipedia.org/wiki/Loop_unwinding#A_simple_example
>>
>> might shed some light on what might happen.
>>
>> james.
>>
>>>On Mon, Sep 7, 2009 at 6:14 PM, james morris<james at jwm-art.net> wrote:
>>>>
>>>> On 6/9/2009, "Rob Myers" <rob at robmyers.org> wrote:
>>>>
>>>>>On 06/09/09 22:23, james morris wrote:
>>>>>>
>>>>>>> You could unroll loops in the code manually using templates for
>>>>>>> different sections of the code. Or instantiate objects with other templates.
>>>>>>
>>>>>> Eurgh that's made me feel quite sick.
>>>>>
>>>>>It's a good job I didn't mention colouring in the letters to represent
>>>>>the compiled code then. ;-)
>>>>>
>>>>
>>>> I don't know about that. It was just the image of having something
>>>> physical - a large roll of paper - with code stenciled into it, and
>>>> applying the GNU C Compiler's -funroll-loops optimization to it, ++
>>>> that with C++ Templates, and stencils, templates, loops, and rolls. Spun
>>>> my head right round, and it was to me, pure genius of you to think of it
>>>> like that. I never thought jokes about programming could be so funny!!!!
>>>> Because all that I saw in Pall's stencil was a visual stencil of some
>>>> code, which looked quite attractive in a certain way.
>>>> _______________________________________________
>>>> NetBehaviour mailing list
>>>> NetBehaviour at netbehaviour.org
>>>> http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>>>>
>>>
>>>
>>>
>>>--
>>>*****************************
>>>Pall Thayer
>>>artist
>>>http://www.this.is/pallit
>>>*****************************
>>>_______________________________________________
>>>NetBehaviour mailing list
>>>NetBehaviour at netbehaviour.org
>>>http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>>>
>> _______________________________________________
>> NetBehaviour mailing list
>> NetBehaviour at netbehaviour.org
>> http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>>
>
>
>
>--
>*****************************
>Pall Thayer
>artist
>http://www.this.is/pallit
>*****************************
>_______________________________________________
>NetBehaviour mailing list
>NetBehaviour at netbehaviour.org
>http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>
More information about the NetBehaviour
mailing list