Skip to Content
0
Mar 01, 2014 at 06:30 PM

Problem using dot-notation in argument to my function

41 Views

I am using Powerbuilder 12.5. The problem is that I send null into a function but inside the function, the parameter variable contains a number like 12 or 16.

This problem shows up when all 3 of these are true:

  1. I am NOT running in the Powerbuilder IDE. I build the application and run the executable. So, no debugger.
  2. I call a function and use dot-notation in the argument, i.e.
    of_testingnullarg( tab_2.tabpage_comp_info.dw_webcomp_info.object.dormant[i] )
  3. The above dormant[i] control contains null.

I can make the problem go away if I first save the value inside a variable. For example:

long ll_dormant

ll_dormant = tab_2.tabpage_comp_info.dw_webcomp_info.object.dormant[i]

of_testingnullarg( ll_dormant )

I use if statements and the isNull() and messageBox() functions to test the value before I call the function. Then, inside the function I do the same to test the value of the parameter. When I am passing a non-null value of course I do not see a difference between passed argument and the function's parameter. But when the control holds a null that it read from my database table, then the parameter is not null. Unfortunately, it holds a very believable number for my application and is consistently the same number. I think a pointer on the call stack must be a couple bytes off. Just a theory. I don't know why it doesn't happen when I run inside the IDE.

I am passing by value. The datawindow says the type of dormant is long. My function's parameter type is also long.

Any ideas? Can others reproduce this?