Am 09.06.2016 14:30 schrieb "José Mejuto" <joshy...@gmail.com>: > > El 09/06/2016 a las 8:04, Sven Barth escribió: > >>> {$DEFINE THISDONTCOMPILE} >>> TConstRecord: TFirstRecord = ( >>> {$IFDEF THISDONTCOMPILE} >>> Ident: TSomePcharArray[1] >>> {$ELSE} >>> Ident: @TSomePcharArray[1] >>> {$ENDIF} >>> ); > > >> One can only use untyped constants to initialize other constants or >> variables in their declarations. The TsomePCharArray is a typed >> constant, thus not suitable for assignments (a pointer to it's element >> is however legal as you noticed). > > > Hello, > > The strange thing is that if I use a pointer, an integer or any other type instead a Pchar the error message is completely different "Error: Can't read or write variables of this type" which is a bit more informative. > > I understand that untyped is the only source for assign a constant to so using @ I get an untyped pointer and the assign is performed, but is there a way to convert a pointer (typed) to untyped one ?
Typed and untyped pointer have nothing to do with this. It's about typed and untyped constants. And addresses to variables and typed constants are by definition untyped constants as well. > I think that the solution is to pollute the symbol table with a lot of consts, one of each text string. > > Thank you for your help and enlightenment. You're welcome. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal