Re: D7 Compiler Bug

From: Jamie (
Date: 09/24/04

Date: Fri, 24 Sep 2004 13:27:02 -0700

VBDis wrote:

> Unfortunately the existence of calls to InitializeRecord etc. is not a proof
> for correct code creation of the compiler, since these calls can be forced by
> dynamic elements in the "top level" data type, or by the existence of local
> variables of the affected types. It's also hard to determine which fields of a
> datastructure are processed by InitializeRecord and FinalizeRecord, since the
> offsets of the affected fields are passed to these subroutines in a hidden data
> structure.
> Sample code:
> type
> TBase = Object
> public
> s: string;
> end;
> TDerived = Object(TBase)
> end;
> procedure test;
> var obj: TDerived; //okay for TBase!
> begin
> assert(obj.s = '', 'uninitialized dynamic variable');
> end;
> DoDi
the compiler is doing exactly what it should be doing, the string is
treated like any standard string that you may create
at the entry point of a block.
  also take not that you are not using the dynamic type of objects which
would be the Tobject in this case, but the objects which came first.
   i know its nice the delphi still supports these types and i am glad
that they do.
   these types are static types in the way you did it.
  you need to initiate the code your self.
  its no different from the need to clear the string or define it to
something on the entry of a code block.
   the years of TP i did i never saw any docs stating that these objects
were initiated automatically, you may also want to take note that this
kind of string your using is not the default 255 byte long string but a
dynamic string.
   specify a size of 255 or less in the string instead and then you will
have the exact of TP.

Relevant Pages

  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... Big-O notation isn't mathematics per se, it's computer science notation ... "length of the string". ... outrun something compiled and optimized by a good C compiler. ... > either general computing culture or culture outside computing. ...
  • Re: [EGN] Hoisting Loop Invariants (Was: Re: [EGN] Numerical Accuracy)
    ... compiler out there somewhere that did as you claim. ... > the programmer has this knowledge, then the programmer should not use ... >> string in a loop, regardless of the blatant inefficiency of doing so. ...
  • Re: How to convert Infix notation to postfix notation
    ... and make all strings const save where the intent ... function whose contract is to change the string. ... the compiler "just" prevents the string ... try to do using the pointer you get. ...
  • Re: PL/I string representations
    ... >> of the language, so it was interesting to me, hopefully it will be to ... I found a workable compiler for Fortran in 1971 (with a bug ... >> The specified length is the minimum, and each time a character ... >> string is assigned to E, the length is stored with it. ...
  • Why C Is Not My Favourite Programming Language
    ... C has no string type. ... compiler take care of the rest. ... Why does any normal language ... the programmer fail. ...