[fpc-devel] [patch] removing compiler warning from aasmtia.pas unit

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Oct 25 17:16:47 CEST 2010


Hi,

I'd like to learn something here, so that's why I'm asking for a further
explanation of this.


Jonas said in the now resolved Mantis report:
"The code is not trying to lower any visibility. The first declaration of
that constructor is in tai_section itself. And making it private does make
it inaccessible from other units."


I still think this is wrong. See the class class hierarchy below.


    TObject
       |
  TLinkedListItem
       |
      tai
       |
    tai_section



TObject already defines a constructor as public. That's it, now you can
lower the constructor visibility.

TLinkListItem defines public constructors.

Tai defines public constructors.

So how can tai_section


So yes, tai_section might have that "one" constructor as private, but in no
way does it stop anybody from creating an instance of that class with all
the inherited constructors (all being public).  And in doing so, it will
put that tai_section instance in an "undefined" state, because it doesn't
execute the code implemented in that private constructor.

So this just seems wrong on so many levels, and the FPC compiler rightfully
gives a warning about this.


Regards,
  - Graeme -





More information about the fpc-devel mailing list