Singelton Interface
Brought to you by:
dcornewell
Might I suggest implmenting a singelton type interface
here rather than passing around an agi structure. The
can only be one agi structure per program, so forcing
the user to pass it around is unnecessary.
There are several ways you could do this. You could
have a global pointer to the agi stuff that is
initilized when the user initilizes the agi stuff, and
each function could use this global pointer instead of
making the user pass it one.
Just a suggestion.
Logged In: YES
user_id=765158
You are absolutely correct in your statement. However, I
have developed habits from programming in multi threaded
environments. I have a personal problem with global
variables. While you are correct in saying that a single global
will not cause any problems, but I would feel dirty doing it. I
may look into setting up some macros and having it return a
structure rather than being passed one. That would save a
little typing, but I think this is a minor thing. If I get any spare
time to work on this I will probably finish adding support for
the rest of PHPAGI's features.
Thank you for the comments. I have moved this in to a
feature request. I didn't see any bug here. Let me know if
there is so I can move it back.
Logged In: YES
user_id=287248
Well I don't know the best way to do a singleton in c, but I
imagine you could also use a function with a static
variable/structure for the agi stuff too. But it is as you
said mostly a cosemetic tweak.