vector crash

Renato renato at athaydes.com
Thu Jan 18 21:07:37 UTC 2024


On Thursday, 18 January 2024 at 04:31:52 UTC, zjh wrote:
> On Thursday, 18 January 2024 at 04:24:18 UTC, zjh wrote:
>
> ```d
> class V : ASTVisitor
> {
>     Vector!string f=[];
>     alias visit = ASTVisitor.visit;
>     override void visit(const FunctionDeclaration decl)
>     {
>         writeln(' '.repeat(indentLevel * 4), decl.name.text);
>         f.push_back(decl.name.text);
>         indentLevel++;
>         scope (exit) indentLevel--;
>         decl.accept(this);
>     }
>     void out(string s){
>         string b=s~".t";toF(f,b);
>     }
> }
>
> ```

I don't want to sound like a StackOverflow moderator, but if you 
just post some random code and say something like "why crash", 
you won't get any helpful responses here or anywhere. The code 
snippets you've posted don't make any sense and as others 
mentioned, is obviously incomplete and won't compile.

Please explain what you're trying to do, post short code snippets 
that are readable (don't use names like `a` and `e`, we don't 
have the context at all of what you're doing - we cannot guess 
with names like that without spending lots of time basically 
de-obfuscating your code) and explain what you expected, and how 
the outcome differs from that.

If you do that, lots of people will help, I can guarantee!


More information about the Digitalmars-d-learn mailing list