July 23, 2004 repost: inout arrays and inner functions | ||||
|---|---|---|---|---|
| ||||
Pretty straightforward. There's a stack issue where inner functions can't access char arrays. Doing the work inside func() itself runs correctly.
D:\code\d>type test6.d
void func( inout char[] buf )
{
void app() { buf ~= 'x'; }
app();
}
int main()
{
char[] buf;
func( buf );
printf( "%.*s\n", buf );
return 0;
}
D:\code\d>test6
Error: Access Violation
D:\code\d>
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply