HP Forums

Full Version: compile order problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
order problem

EXPORT TX=0;

//EXPORT TOTTER; //doesnt work
//EXPORT TOTTER(); //doesnt work

EXPORT TEETER()
BEGIN
IF TX>4 THEN
RETURN TX;
ELSE
TOTTER(); // <- error here
END;
END;



EXPORT TOTTER()
BEGIN
IF TX>4 THEN
TX:=TX+1;
RETURN TX;
ELSE
TEETER();
END;


Does anyone know how to make this compile?
Its not about recursion but about order of compilation and lack of declarations.
I have seversl "files" whick cross call routines and csnt conrol the order. of compilation.

Using two different files also fails since neither succeeds.
One way:

Code:

TOTTER();
LOCAL TX;

EXPORT TEETER()
BEGIN
  IF TX>4 THEN
    RETURN TX;
  ELSE
    TX:=TOTTER(); // <- 
  END;
  TEETER();
END;

TOTTER()
BEGIN
  TX:=TX+1;
END;

-Dale-
The solution:

EXPORT TX=0;

TOTTER(); // forward declaration, no need for EXPORT here


EXPORT TEETER()
BEGIN
IF TX>4 THEN
RETURN TX;
ELSE
TOTTER(); // no error
END;
END;



EXPORT TOTTER()
BEGIN
IF TX>4 THEN
TX:=TX+1;
RETURN TX;
ELSE
TEETER();
END; // u forgot second END here ???
END;
Thanx to both.

Didnt try the bare decl.

If they are in different files will export work.?
Reference URL's