The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Bug? accessing LOCAL var in shared scope
12-03-2014, 10:37 PM
Post: #1
Bug? accessing LOCAL var in shared scope
I have been using LOCAL vars declared outside the programs, to get the equivalent of variables shared between routines in the same program, but not exported globally.

There is something strange going on whenever I try to use these variables as function arguments; they are not accessed at all. I always have to copy them to a local variable first. Example:

Code:
LOCAL foo=[[1,2],[3,4]];
EXPORT GlobalVarIgnored()
BEGIN
  PRINT();
  PRINT(foo);
  PRINT(colDim(foo));

  LOCAL bar=foo;
  PRINT(bar);
  PRINT(colDim(bar));
END;

I would expect both PRINT(colDim(foo)) and PRINT(colDim(bar)) to print out same number (2), but instead the output of the program is:
Code:
[[1,2],[3,4]]
colDim(foo)
 Error: Bad Argument Value
[[1,2],[3,4]]
2
What's going on? Is this a bug or have I missed something?

(Discovered in 6030; confirmed in 6940.)

/Lennart Börjeson
Stockholm, Sweden
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Bug? accessing LOCAL var in shared scope - lenborje - 12-03-2014 10:37 PM



User(s) browsing this thread: 3 Guest(s)