ambiguous identifier (null)

Hello,

I have a function, which returns a string (see code below). When I execute the application for the first time after starting DOORS, it returns the error message
-E- DXL: ambiguous identifier (null).
Most strange is the fact, that executing it further times it works, the problem is only the first time after DOORS login. This is quite annoying for the users.
Can anyone help me? Has anyone had a similar problem?

Thanx a lot!

----

string getStyleForColumn(Object o, Column c)
{
DxlObject d
string n = title c

if (n0:10 "" == "invisible") n = n11:
if (n[0] "" == " ") n = n1:

if (find(columnStyles, n, d))
{
// print "I FOUND A STYLE for Column " (title c) "\n"
return (string d->aStyle)
}

return null
}
cfuseche - Tue Jan 26 05:48:54 EST 2010

Re: ambiguous identifier (null)
Peter_Albert - Tue Jan 26 06:19:19 EST 2010

Hi cfuseche,

first of all, it really helps if you put { code } (without the empty spaces) around your code fragments, this improves readability, and it avoids errors like the one in your example, where

n[0:10]

has been transformed into "n0:10" being a hyperlink into nowhere.

Secondly, it helps if the code fragment is a self-standing piece of code with which we can reproduce the error message. In your example, this is not possible, as e.g. the Skip list "columnStyles" is neither defined nor filled, nor can we see how you actually call "getStyleForColumn", etc. (As a side effect, when preparing the self-standing code to be posted, typically 90% of the bugs are found by yourself :-)

Thirdly, (but ignorable if you go for the second recommendation), it helps if you tell us the code line in which the error occurs. "ambiguous identifier (null)" sounds like being object related, but then you are not using the object variable nowhere in the script. Might it be that the error occurs somewhere outside the code snippet you posted? Probably using an object handle assuming it is not null, but it actually is (the "current Object" can be null sometimes, so it is always worth checking)?

Now, this all doesn't solve your actual problem, but if you update your post, we can possibly actually help.

Regards,

Peter

Finally, a recommendation regarding DxlObjects. They are not documented, so you might want to know that they can create memory leaks, especially when collected in Skip lists. To avoid this, when you delete the Skip list, you should loop through the Skip list first and delete all DxlObjects inside, then delete the Skip list itself.

Re: ambiguous identifier (null)
llandale - Tue Jan 26 13:15:16 EST 2010

When I run this piece of code:

string A()
{  return null
}


I get these errors:

 

-E- DXL: <Line:2> ambiguous identifier (null)
-I- DXL: all done with 1 error and 0 warnings


Yes, the first time. If I run it again, like you said, I only get no errors. Very curious. Got no idea why it does that.

I've always had some trouble with string "null", since its not always the same 'value' as the null string, two-double-quotes. I often do this:

 

 

string Result = someSystemCall(p1)
if (null Result) Result = ""   // fixes wierd bug


Frankly, I don't recall how that bug manifests itself.

Anyway, I don't use string (null) I just use the null string. I thus routinely do these:

 

 

string Value = ""
...
return("")


Change it to return "" and it will work.

 

 

 

  • Louie


And frankly, now that I think about it, perhaps the reason I don't recall this 'wierd' bug is because I never notice that it only fails the first time I run some of my DXL. Wierd ... until you figure it out.

 

 

Re: ambiguous identifier (null)
Mathias Mamsch - Sat Jan 30 07:18:36 EST 2010

The reason for the ambiguous identifier is that DOORS defines a couple of null perms:
 

bool null (string)
bool null (_n)
_m null ()
string null ()
bool null (real)
real null ()
IconID null ()

 


The problematic thing is that there is a string null() and an _m null(), the second one matching every datatype. I cannot say why exactly the error will only come once but you can resolve the issue if you do a

 

 

return null string


or a

 

string s = null;   return s

 


Regards, Mathias