March 24, 2005
Why the program produced from the following code enters loop which ends with the message: "Error: Access Violation"?

import std.c.stdio;

typedef u *u();

u *s()
{
 static int x = 0;
 printf("%d\n", x++);
 return s;
}

int main(){
 s();
 return 0;
}

For the below code the compiler (v0.119) reports "Internal error:
..\ztc\cgcod.c 1445":

import std.c.stdio;

typedef u *u();

u s()
{
 static int x = 0;
 printf("%d\n", x++);
 return s;
}

int main(){
 s();
 return 0;
}

Thank you,
Brian


March 24, 2005
I reposted the message because for some unknown reason(s) it didn't appear in my
newsreader.

In article <d1uemp$2a34$1@digitaldaemon.com>, Brian Gardner says...
>
>Why the program produced from the following code enters loop which ends with the message: "Error: Access Violation"?
>
>import std.c.stdio;
>
>typedef u *u();
>
>u *s()
>{
> static int x = 0;
> printf("%d\n", x++);
> return s;
>}
>
>int main(){
> s();
> return 0;
>}
>
>For the below code the compiler (v0.119) reports "Internal error:
>..\ztc\cgcod.c 1445":
>
>import std.c.stdio;
>
>typedef u *u();
>
>u s()
>{
> static int x = 0;
> printf("%d\n", x++);
> return s;
>}
>
>int main(){
> s();
> return 0;
>}
>
>Thank you,
>Brian
>
>