Pointers to structs...

Non-platform specific questions.

Pointers to structs...

Postby linux_man007 » Sun Apr 11, 2004 10:05 pm

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...
linux_man007
 
Posts: 59
Joined: Sun Nov 23, 2003 11:35 pm
Location: Rochester, MN USA
Score: 0 Give a positive score

Postby makslane » Mon Apr 12, 2004 2:05 pm

The script support only C syntax, without C++ extensions, so, you must use this:

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

Lock* ReturnLockStruct()
{
...
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest