Page 1 of 1

Pointers to structs...

PostPosted: Sun Apr 11, 2004 10:05 pm
by linux_man007
Makslane, I'm not quite sure whether this is a bug or whether it isn't.
My problem is that when I try to have a function return a pointer to a user-defined structure,
The global code editor doesn't see the return type and therefore thinks that the function name is undeclared. For example:

typedef struct Lock
{
Actor* SourceActor;
Actor* TargetActor;
};

Lock* ReturnLockStruct()
{
. . .
. . .
}

Am I required to precede Lock with the struct keyword?
I've tried it and it works, but is it necessary to use this syntax?
I'm used to programming in C++, with which I think that the
syntax I used up on top is legal...

PostPosted: Mon Apr 12, 2004 2:05 pm
by makslane
The script support only C syntax, without C++ extensions, so, you must use this:

typedef struct stLock
{
Actor* SourceActor;
Actor* TargetActor;
} Lock;

Lock* ReturnLockStruct()
{
...
}