www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Error: Access Violation

reply "Brian Gardner" <briangr friberg.us> writes:
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
Mar 24 2005
parent Brian Gardner <Brian_member pathlink.com> writes:
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
Mar 24 2005