POV-Ray : Newsgroups : povray.beta-test : Can't undefine defined entry of array Server Time
30 Jul 2024 08:29:44 EDT (-0400)
  Can't undefine defined entry of array (Message 5 to 14 of 24)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>
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

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

Skiba <abx### [at] babilonorg>  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."

And???  I see nothing about #undef here, so why would this be relevant?

    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 10:09:54
Message: <3c4d80c2@news.povray.org>

Skiba <abx### [at] babilonorg>  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.

Yes, because "B" is a valid symbol name.  "A[0][0]" is not.

    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 10:18:53
Message: <me0r4uki1o2gtu0ml7sm2bqc1jsptane56@4ax.com>
On Tue, 22 Jan 2002 16:09:41 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> > There is also no symbol with name "B" but when I replace #undef A[0][0] with
> > #undef B then behaviour is different.
>
> Yes, because "B" is a valid symbol name.  "A[0][0]" is not.

The difference is too subtle for my English so I stay with "it is feature
request". Sorry for bothering - I just buy 1 GB of memory and use it as is :-(

ABX
--
disc{z,-z 5#macro O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
e=e-1;#end#local e=26;pigment{#local g=function(_){ceil(_)-_}function#local//X
k=function{pattern{object{sphere_sweep{linear_spline 13#while(e>0)<O(),O()//AB
>.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient 1}}//POV35


Post a reply to this message

From: Tom Melly
Subject: Re: Can't undefine defined entry of array
Date: 22 Jan 2002 10:20:44
Message: <3c4d834c$1@news.povray.org>
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:3c4d8084@news.povray.org...
> In article <9kpq4uk15iqbmu674hbamr6esvt5vhogbs@4ax.com> , W"odzimierz ABX
> Skiba <abx### [at] babilonorg>  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."
>
> And???  I see nothing about #undef here, so why would this be relevant?
>

Well, it's relevant because it says "has been declared", not "has been
assigned".

I think this problem is a shortcoming in the docs rather than a bug. Whilst
no-one expects the docs to specify everything you can't do in pov, there are a
few cases when such "do nots" would be appropriate, and this would be one of
them. In this case, arrays should always talk about assignment of array
elements, not declarations, and a short sentance that array elements cannot be
#undefed could be added.

Are you always so rude? IMHO if experienced users can be confused by such
issues, God help the newbies.


Post a reply to this message

<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>

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