Bad Pointers

View: New views
5 Messages — Rating Filter:   Alert me  

Bad Pointers

by Nigel Greenlee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All

I have a system which has been updated to V11 and something odd is  
happening. My testing has been done on OSX, the code referred to below  
is 'mature' code that has been in use for years without error. Unicode  
is not switched on.

  I know  some changes have taken place in pointers..but this one is  
stumping me so maybe I turned two pages of the manual somewhere.

This line of code is putting the data from a field into a variable
(array)
$pArr->{$2}:=$pFld->

$PFld is (in the cases where the error happens) a pointer to a an  
alpha field and $parr is a pointer to a string array and $2 is a  
longint and is a valid row of that array. These are local pointers not  
pointing to locals. The error only happens (i think) when the content  
of the field being pointed at is empty.

I am getting an error(compiled only), the error is 'attempting to  
retype using a pointer'  but only on the assignment of Alpha  
values ...Longints..Dates..etc etc seem fine.

So to validate what is happening i have added the following

$Type2:=Type($pArr->)
$Type:=Type($pFld->)

$Type the type of data the field pointer is pointing at is 0(string  
field)
$Type2 the type of data in the array is 21(String array), and is not  
pointing to a local array.

And i want to alert myself as to what is the value $pFld is pointing  
at to track the error, because you would think we are trying to put  
something other than alpha data into and alpha array or something like  
that.

ALERT("Value is "+$pFld->)


Which also gets the same error-so the problem is not with the  
assignment to the array element, which one might suspect.

If i replace the above with.

C_TEXT($string)

$String:=$pfld->
Alert("Value is"+ String)
$pArr->{$2}:=$String

my error goes away. It simple to change this assignment in this  
instance, however this type of assignment is used frequently and I am  
finding myself 'fixing'  a lot of code, and it makes little sense why  
a direct accrss to a pointer produces an error and assigning it to a  
local variable does not. Oddly when this error happens the system does  
not drop into our normal error handler, this is  happening on several  
data files, and just to be sure i checked the data with MSC

What did i miss? Has anyone else seen this? or is this something i  
should report to 4D?


nigel.greenlee@...
  www.cleardaysoftware.com
  Tel: +44 (0)1296 330633 Mob: +44 (0)7711 985095




**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Bad Pointers

by Chip Scheide :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this sounds to me like something to report

the Alert command should function regardless of whether the field being
referenced is text or string, so it would appear to me that there maybe
a problem with pointer dereferencing.

Have you tried a new simple database to see if this continues to occur?


On Wed, 4 Nov 2009 04:49:10 +0000, Nigel Greenlee wrote:
>
> What did i miss? Has anyone else seen this? or is this something i
> should report to 4D?
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Bad Pointers

by Chris Curnow-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nigel,

I have seen this happen quite a lot. I have given up trying to  
understand why, I just use the solution you have found and it works.

David Adams had a go at what might be going on here a while back. But  
I don't think even he was satisfied that it was a complete explanation  
basically we say that's just the way it is.

Chris Curnow




On 04/11/2009, at 3:49 PM, Nigel Greenlee  
<nigel.greenlee@...> wrote:

> If i replace the above with.
>
> C_TEXT($string)
>
> $String:=$pfld->
> Alert("Value is"+ String)
> $pArr->{$2}:=$String
>
> my error goes away.
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Bad Pointers

by Alan Tilson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Nigel,

v11 handles null values differently than previous versions, so I suspect
that what you are dealing with is related to this. Have you checked the *Map
NULL values to blank values* checkbox for each field? I actually haven't had
null field problems with internal data, but I have with external data.

Just an idea...
Alan

On Tue, Nov 3, 2009 at 11:49 PM, Nigel Greenlee <
nigel.greenlee@...> wrote:

> All
>
> I have a system which has been updated to V11 and something odd is
> happening. My testing has been done on OSX, the code referred to below is
> 'mature' code that has been in use for years without error. Unicode is not
> switched on.
>
>  I know  some changes have taken place in pointers..but this one is
> stumping me so maybe I turned two pages of the manual somewhere.
>
> This line of code is putting the data from a field into a variable(array)
> $pArr->{$2}:=$pFld->
>
> $PFld is (in the cases where the error happens) a pointer to a an alpha
> field and $parr is a pointer to a string array and $2 is a longint and is a
> valid row of that array. These are local pointers not pointing to locals.
> The error only happens (i think) when the content of the field being pointed
> at is empty.
>
> I am getting an error(compiled only), the error is 'attempting to retype
> using a pointer'  but only on the assignment of Alpha values
> ...Longints..Dates..etc etc seem fine.
>
> So to validate what is happening i have added the following
>
> $Type2:=Type($pArr->)
> $Type:=Type($pFld->)
>
> $Type the type of data the field pointer is pointing at is 0(string field)
> $Type2 the type of data in the array is 21(String array), and is not
> pointing to a local array.
>
> And i want to alert myself as to what is the value $pFld is pointing at to
> track the error, because you would think we are trying to put something
> other than alpha data into and alpha array or something like that.
>
> ALERT("Value is "+$pFld->)
>
>
> Which also gets the same error-so the problem is not with the assignment to
> the array element, which one might suspect.
>
> If i replace the above with.
>
> C_TEXT($string)
>
> $String:=$pfld->
> Alert("Value is"+ String)
> $pArr->{$2}:=$String
>
> my error goes away. It simple to change this assignment in this instance,
> however this type of assignment is used frequently and I am finding myself
> 'fixing'  a lot of code, and it makes little sense why a direct accrss to a
> pointer produces an error and assigning it to a local variable does not.
> Oddly when this error happens the system does not drop into our normal error
> handler, this is  happening on several data files, and just to be sure i
> checked the data with MSC
>
> What did i miss? Has anyone else seen this? or is this something i should
> report to 4D?
>
>
> nigel.greenlee@...
>  www.cleardaysoftware.com
>  Tel: +44 (0)1296 330633 Mob: +44 (0)7711 985095
>
>
>
>
>
> **********************************************************************
> Get the speed and power of 4D v11 SQL
> before upgrade prices increase - http://www.4d.com
>
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4D.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4D_Tech-Unsubscribe@...
> **********************************************************************
>
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com
   

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: Bad Pointers

by David Nasralla :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nigel,

I can tell you that v11 seems to pretty much require a compiler
declaration for any variable you attempt to point to for it to work in
compiled mode. This is different than previous versions.

HTH,

dave

On Tue, Nov 3, 2009 at 9:49 PM, Nigel Greenlee
<nigel.greenlee@...> wrote:

> All
>
> I have a system which has been updated to V11 and something odd is
> happening. My testing has been done on OSX, the code referred to below is
> 'mature' code that has been in use for years without error. Unicode is not
> switched on.
>
>  I know  some changes have taken place in pointers..but this one is stumping
> me so maybe I turned two pages of the manual somewhere.
>
> This line of code is putting the data from a field into a variable(array)
> $pArr->{$2}:=$pFld->
>
> $PFld is (in the cases where the error happens) a pointer to a an alpha
> field and $parr is a pointer to a string array and $2 is a longint and is a
> valid row of that array. These are local pointers not pointing to locals.
> The error only happens (i think) when the content of the field being pointed
> at is empty.
>
> I am getting an error(compiled only), the error is 'attempting to retype
> using a pointer'  but only on the assignment of Alpha values
> ...Longints..Dates..etc etc seem fine.
>
> So to validate what is happening i have added the following
>
> $Type2:=Type($pArr->)
> $Type:=Type($pFld->)
>
> $Type the type of data the field pointer is pointing at is 0(string field)
> $Type2 the type of data in the array is 21(String array), and is not
> pointing to a local array.
>
> And i want to alert myself as to what is the value $pFld is pointing at to
> track the error, because you would think we are trying to put something
> other than alpha data into and alpha array or something like that.
>
> ALERT("Value is "+$pFld->)
>
>
> Which also gets the same error-so the problem is not with the assignment to
> the array element, which one might suspect.
>
> If i replace the above with.
>
> C_TEXT($string)
>
> $String:=$pfld->
> Alert("Value is"+ String)
> $pArr->{$2}:=$String
>
> my error goes away. It simple to change this assignment in this instance,
> however this type of assignment is used frequently and I am finding myself
> 'fixing'  a lot of code, and it makes little sense why a direct accrss to a
> pointer produces an error and assigning it to a local variable does not.
> Oddly when this error happens the system does not drop into our normal error
> handler, this is  happening on several data files, and just to be sure i
> checked the data with MSC
>
> What did i miss? Has anyone else seen this? or is this something i should
> report to 4D?
>
>
> nigel.greenlee@...
>  www.cleardaysoftware.com
>  Tel: +44 (0)1296 330633 Mob: +44 (0)7711 985095
>
>
>
>
> **********************************************************************
> Get the speed and power of 4D v11 SQL
> before upgrade prices increase - http://www.4d.com
>
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4D.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4D_Tech-Unsubscribe@...
> **********************************************************************
>



--
David Nasralla
Clean Air Engineering
**********************************************************************
Get the speed and power of 4D v11 SQL
before upgrade prices increase - http://www.4d.com


4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************