[fpc-pascal] Re: classes initialization
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Mar 25 12:49:09 CET 2008
On 25 Mar 2008, at 13:40, L wrote:
> What about old borland objects (heap and stack initialization)
> process?
>
> I am guessing they are more like records...
They are exactly like records.
> or do heap objects act like classes in that they are filled with
> zeros?
Unlike classes, objects have no hidden dereferencing or whatever and
follow exactly the same semantics as other types regardless of whether
they are on the stack or on the heap.
> p.s. I think the inconsistent behavior between local scope records
> and global scope records is kind of a flaw/danger in modern pascal..
> as the bugs may not be caught until someone builds a program with
> local scope var..
Using uninitialised variables is virtually always bad, regardless of
the scope. And the fact that global variables are zeroed at the
program start is afaik not defined by the Pascal standard. It's just a
side effect of the way most operating systems work.
Jonas
More information about the fpc-pascal
mailing list