POV-Ray : Newsgroups : povray.beta-test : Can't undefine defined entry of array Server Time
30 Jul 2024 10:22:04 EDT (-0400)
  Can't undefine defined entry of array (Message 1 to 10 of 24)  
Goto Latest 10 Messages Next 10 Messages >>>
From:
Subject: Can't undefine defined entry of array
Date: 22 Jan 2002 04:34:11
Message: <kecq4uo1ttrfq63srouqa8sfgimk1fqhut@4ax.com>
POV 3.5 b 10.icl on PII 233 128 MB with NT 4 Sp 6

Since checking of defined pointer is possible for entries of array then
undefinig should be possible also. But I can't undefine it:

//<SDL>
#declare A=array[1][1];
#declare A[0][0]=0;
#ifdef(A[0][0])#undef A[0][0]#end
//</SDL>

Output:
#ifdef(A[0][0])#undef A[0][0] <----ERROR
Parse Error: Tried to free undefined symbol

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 06:13:00
Message: <3c4d493c@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> Since checking of defined pointer is possible for entries of array then
> undefinig should be possible also.

No, it shouldn't.  What would the suggested change do?  Resize the array?
Keep an "undefined" element in the array and issue the error later?  You can
undef the array, which is exactly what you are supposed to be able to do.
It has never been stated that you can undef array elements, thus this is
surely not a but and only a rather strange and unfinished feature request.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 06:37:23
Message: <ediq4ukcihbillqkpjjtsh051m2nb4o2lf@4ax.com>
On Tue, 22 Jan 2002 12:12:57 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> > Since checking of defined pointer is possible for entries of array then
> > undefinig should be possible also.
>
> No, it shouldn't.  What would the suggested change do?  Resize the array?

Documentation says: "Large uninitialized arrays do not take much memory.
Internally they are arrays of pointers so they probably use just 4 bytes per
element. Once initialized with values, they consume memory depending on what you
put in them."

So when I want undef entry it means imo: free memory pointed by this entry and
write NULL (or eqivalent) into this pointer/entry.

> You can
> undef the array, which is exactly what you are supposed to be able to do.

If it is really feature request then sorry but I think it is large wasting of
memory in this case. Imagine large array of points. For some reason to determine
important points I have to calculate them all. But when they calculated I don't
need not important points so I want undef part of entries fo save memory for
next purposes. All workarounds with external file or rewriting array slows
parsing a lot. But if it is really feature request then sorry again.

> It has never been stated that you can undef array elements.

6.2.2.4 says: "You may however un-define an identifier using the #undef
directive." So what is identifier ? 6.2.2.1 answers imo that identifier is
everything what can be declared. Entry of array can be declared and can be
tested via ifdef(), ifndef(), defined().

ABX


Post a reply to this message

From:
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 06:50:36
Message: <obkq4ugnrr4f5fuqul8p1rr53t3jgl4jgb@4ax.com>
On Tue, 22 Jan 2002 12:12:57 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> It has never been stated that you can undef array elements, thus this is
> surely not a but and only a rather strange and unfinished feature request.

At least it is bug in parser becouse it says "Tried to free undefined symbol."
while it is defined one becouse returns true in #ifdef() statement.

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 08:00:26
Message: <3c4d626a@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

>> No, it shouldn't.  What would the suggested change do?  Resize the array?
>
> Documentation says: "Large uninitialized arrays do not take much memory.
> Internally they are arrays of pointers so they probably use just 4 bytes per
> element. Once initialized with values, they consume memory depending on what
> you put in them."

Where is it and was it in the 3.1 docs as well?

>> It has never been stated that you can undef array elements.
>
> 6.2.2.4 says: "You may however un-define an identifier using the #undef
> directive." So what is identifier ? 6.2.2.1 answers imo that identifier is
> everything what can be declared. Entry of array can be declared and can be
> tested via ifdef(), ifndef(), defined().

Yes, but you do not declare the array identifier with this syntax, you
assign a value to it.  Without previously declaring the _array_ identifier
you cannot _assign_ a value to it.  You are confusing a declaration and
assignment statement here!

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 08:01:53
Message: <3c4d62c1@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

>> It has never been stated that you can undef array elements, thus this is
>> surely not a but and only a rather strange and unfinished feature request.
>
> At least it is bug in parser becouse it says "Tried to free undefined symbol."
> while it is defined one becouse returns true in #ifdef() statement.

It is an undefined symbol:
There is no symbol with the name "A[0][0]", only one with the name "A"!

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 08:16:42
Message: <pdpq4u4c9vbnfunuo51ee390u8nn2f4o09@4ax.com>
On Tue, 22 Jan 2002 14:01:51 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> It is an undefined symbol:
> There is no symbol with the name "A[0][0]", only one with the name "A"!

There is also no symbol with name "B" but when I replace #undef A[0][0] with
#undef B then behaviour is different.

ABX


Post a reply to this message

From:
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 08:24:11
Message: <9kpq4uk15iqbmu674hbamr6esvt5vhogbs@4ax.com>
On Tue, 22 Jan 2002 14:00:23 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> You are confusing a declaration and
> assignment statement here!

From doc (6.2.6.2): "The #ifdef and #ifndef directives can be used to determine
whether a specific element of an array has been declared."

ABX


Post a reply to this message

From: Tom Melly
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 09:43:58
Message: <3c4d7aae$1@news.povray.org>

news:ediq4ukcihbillqkpjjtsh051m2nb4o2lf@4ax.com...
> On Tue, 22 Jan 2002 12:12:57 +0100, "Thorsten Froehlich" <tho### [at] trfde>
> wrote:

<snip>

Don't want to comment on whether this is a bug or not, but a possible workaround
for memory usage would be to redefine any unwanted array elements to a simple
case - e.g. if your array contains large objects, redefine unwanted elements to
spheres.

Since the array just stores a pointer, it's the thing pointed to by the pointer
that you want to remove, not the pointer itself. All IMHO BTW.

Also, might it not be more efficient to copy the array elements you want to a
new array of the correct size, and then undef the whole of the old array?


Post a reply to this message

From:
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 09:56:22
Message: <01vq4uk00l0oepmk80579ibj6ip7gdc0l9@4ax.com>
On Tue, 22 Jan 2002 14:43:58 -0000, "Tom Melly" <tom### [at] tomandlucouk> wrote:
> Don't want to comment on whether this is a bug or not, but a possible workaround
> for memory usage would be to redefine any unwanted array elements to a simple
> case - e.g. if your array contains large objects, redefine unwanted elements to
> spheres.

My case (case where this feature appeared) was large (~100 MB) array of 3D
points. There is no simpler substitute for it.

> Also, might it not be more efficient to copy the array elements you want to a
> new array of the correct size, and then undef the whole of the old array?

I can't declare new array becouse of 128 MB of phisical memory. And I can't do
it in external program becouse it use trace() in calculations.

ABX


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.