Menu ▾ ▴

Initial state of types and record fields

Help
2006-06-11
2012-10-08
  • Bastiaan Veelo

    Bastiaan Veelo - 2006-06-11

    [community.freepascal.org reports a server error when posting, so I post here.]

    Hi,

    We are porting from Extended Pascal to Free Pascal, or at least we are looking into it to estimate the amount of work that is required. The biggest problem that we encounter so far is that Free Pascal does not support initial values in type declarations and record fields.

    Our old code contains lots of type declarations like

    type
    scale = integer = 1024;
    message = record
    header : string = 'Attention';
    body : string = '';
    end;

    If we take out the initial values, we will have to search all sources for places where variables of these types might be used uninitialised...

    What would be the best way around this problem? Could this language feature be considered for inclusion in the compiler?

    On a side note I can mention that

    type
    yes = boolean = true; // is accepted!
    //no = boolean = false; // is not accepted.

    which is probably not intended behaviour.

    Thanks for any thoughts,
    Bastiaan Veelo.

     

Log in to post a comment.