use of colon and jump

Nov 27, 2012 at 11:40am
I came across this piece of code. I don't get how the second definition of function a works

1
2
3
4
5
6
7
int a(int x, int y)
{
    foobar(x, y);
    b:u = a:x + 1;
    b:v = a:y + 2;
    jump b;
}

What is the colon for and what is jump?

Here is the context.

An example in pseudo-C follows. Suppose we have the following functions:

1
2
3
4
5
6
7
8
9
10
11
12
int a(int x, int y)
{
    foobar(x, y);
    return b(x + 1, y + 2);
}
 
 
int b(int u, int v)
{
    foobar(u, v);
    return u + v;
}


Function a can be changed to:

1
2
3
4
5
6
7
int a(int x, int y)
{
    foobar(x, y);
    b:u = a:x + 1;
    b:v = a:y + 2;
    jump b;
}

Nov 27, 2012 at 12:34pm
The first code is not C or C++.

I guess that function-name : variable-name is used to access the variable of the function. Not sure if only parameters can be used this way.

b:u = a:x + 1;
This probably sets the u argument of function b to the value of x+1.

b:v = a:y + 2;
This sets the v argument of function b to the value of y+2.

It might not be possible to have recursive functions in this language because it looks like the function arguments are set globally (tail recursion could work).
Last edited on Nov 27, 2012 at 12:37pm
Topic archived. No new replies allowed.