[Issue 466] New: dmd prevent this from link , if so please prevent it from compiling
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 28 01:51:59 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=466
Summary: dmd prevent this from link , if so please prevent it
from compiling
Product: D
Version: 0.173
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: davidl at 126.com
import std.stdio;
class Exception
{
char[] Exception;
}
void caller()
{
int count=0;
void func(lazy char [] errormessage) // if it can be a nested func inside
the caller would be nice
{
count++;
if (count<3)
{
throw new Exception(errormessage);
}
}
try
{
delete_directory("/home/someuser") ;
}
catch
{
};
}
void delete_directory(char [] dirname)
{
// caller.func("hurray");
// caller.func("hurray");
// caller.func("hurray");
}
void main()
{
caller();
}
and the example code here is trying to interact with the try block owner
i hope compiler would be able to generate the func in the example.
like we have code
import std.stdio;
class Exception
{
char[] Exception;
}
void caller()
{
int count=0;
try
{
delete_directory("/home/someuser") ;
}
catch
{
count++;
if (count<3)
{
continue; // i want that to continue the point
where throw the exception
}
};
}
void delete_directory(char [] dirname)
{
throw new Exception("File1"); // maybe we can add a keyword like
action, to let the try block to determine how to deal with the action, then we
won't affect the exception we have now;
throw new Exception("File2");
throw new Exception("File3");
// caller.func("hurray");
// caller.func("hurray");
// caller.func("hurray");
}
void main()
{
caller();
}
--
More information about the Digitalmars-d-bugs
mailing list