Quantcast
Channel: MaplePrimes - Questions and Posts tagged with goto
Viewing all articles
Browse latest Browse all 7

is there a conflict - using a goto statement and profiling?

$
0
0

Hi everybody,

I got an error message, when i try to profile code with a goto statement inside.
Here is my minimal-example in Maple18. Is there a known conflict or what's wrong?

f := proc(x)
    if x < 0 then goto(POS): end if;
    return "A";
    
    POS:
    return "B";
end proc:

f(-3);
                              "B"
f(3);
                              "A"

CodeTools[Profiling]:-Profile(f);
f(-3);
CodeTools[Profiling]:-PrintProfiles(f);
CodeTools[Profiling]:-UnProfile(f);

Error, (in f) goto to an undefined or unreachable label
f
f := proc(x)
     |Calls Seconds  Words|
PROC |    1   0.000      3|
      1 |    1   0.000      3| if x < 0 then
      2 |    1   0.000      0|   goto(POS)
                               end if;
      3 |    0   0.000      0| return "A";
      4 |    0   0.000      0| POS;
      5 |    0   0.000      0| return "B"
end proc


Viewing all articles
Browse latest Browse all 7

Trending Articles