Recent

Author Topic: FClass<TArray<Char>> can not be compiled  (Read 669 times)

paule32

  • Sr. Member
  • ****
  • Posts: 280
FClass<TArray<Char>> can not be compiled
« on: October 09, 2024, 08:16:36 pm »
Code: Pascal  [Select][+][-]
  1. procedure foo;
  2. var
  3.     myQChar: QChar<TArray<Char>>;
  4. begin
  5.     myQChar := QChar<TArray<Char>>.Create([' ', ' ']);
  6. end;

I get error at compile when using the above code.

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: FClass<TArray<Char>> can not be compiled
« Reply #1 on: October 10, 2024, 12:44:22 am »
TArray<Type> is a generic.

The only true wisdom is knowing you know nothing

cdbc

  • Hero Member
  • *****
  • Posts: 1655
    • http://www.cdbc.dk
Re: FClass<TArray<Char>> can not be compiled
« Reply #2 on: October 10, 2024, 06:42:00 am »
Hi
@Thaddy: I think it's his own compiler  ...hence, I haven't the foggiest...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Thaddy

  • Hero Member
  • *****
  • Posts: 16168
  • Censorship about opinions does not belong here.
Re: FClass<TArray<Char>> can not be compiled
« Reply #3 on: October 10, 2024, 06:43:23 am »
what is a qchar? Benny?
If I smell bad code it usually is bad code and that includes my own code.

cdbc

  • Hero Member
  • *****
  • Posts: 1655
    • http://www.cdbc.dk
Re: FClass<TArray<Char>> can not be compiled
« Reply #4 on: October 10, 2024, 07:23:32 am »
Hi
It's some kind of nonsense, he dreamed up last time he was smoking the big pipe  :D
As far as I can read of his stuff, most of it belongs in /lalalala-land/ Sorry mate, that's just my opinion...
Regards Benny

eta: maybe his idea of a managed string type, gawd help us...
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: FClass<TArray<Char>> can not be compiled
« Reply #5 on: October 10, 2024, 07:27:28 am »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

cdbc

  • Hero Member
  • *****
  • Posts: 1655
    • http://www.cdbc.dk
Re: FClass<TArray<Char>> can not be compiled
« Reply #6 on: October 10, 2024, 07:31:27 am »
Hi
@TRon: I know, I use QT daily, but his nonsense has nothing to do with qt-strings...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: FClass<TArray<Char>> can not be compiled
« Reply #7 on: October 10, 2024, 07:37:50 am »
I know that the snippet still makes no sense cdbc but he seem to have been working on implementing his own (qt) classes (at least that is what I remembered from a previous conversation with TS).

@paule32:
it might perhaps help if you could express what was expected that the code-snippet would do (or is suppose to do).
« Last Edit: October 10, 2024, 08:16:50 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11938
  • FPC developer.
Re: FClass<TArray<Char>> can not be compiled
« Reply #8 on: October 10, 2024, 08:36:41 am »
Afaik that is fixed in trunk  . But I had it for a type declaration, don't know about code on the fly, I never did that.

Thaddy

  • Hero Member
  • *****
  • Posts: 16168
  • Censorship about opinions does not belong here.
Re: FClass<TArray<Char>> can not be compiled
« Reply #9 on: October 10, 2024, 10:56:24 am »
QChar
Ah, I see. Why not use UnicodeChar? That is a fundamental type.
Hm, that is just size 2, - I knew that, sigh - so fails. It should be four. Did somebody complain already, because that is a bug and covers just UCS2.
But there is ucs4char. Delphi behaves the same, though.
« Last Edit: October 10, 2024, 11:10:52 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

paule32

  • Sr. Member
  • ****
  • Posts: 280
Re: FClass<TArray<Char>> can not be compiled
« Reply #10 on: October 10, 2024, 07:54:08 pm »
I use fpc 3.2.2 for using own classes that are similar to Qt 5 Framework.
I use fpc with gnu c++ 20, to get a code base that can be use from fpc, and g++.
The original idea was, to bundle VCL with g++, to form g++ in a C++ Builder like Compiler.
But I could use Com+.
But this is Windows depend, and I am not a fan of Com+.
So I do experiment for cross-development.
You can follow the process at my https://github.com/paule32/fpc-qt account.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5755
  • Compiler Developer
Re: FClass<TArray<Char>> can not be compiled
« Reply #11 on: October 10, 2024, 08:54:32 pm »
Code: Pascal  [Select][+][-]
  1. procedure foo;
  2. var
  3.     myQChar: QChar<TArray<Char>>;
  4. begin
  5.     myQChar := QChar<TArray<Char>>.Create([' ', ' ']);
  6. end;

I get error at compile when using the above code.

The compiler does not yet support nested specializations in mode Delphi. Either use mode ObjFPC, then you can do specialize QChar<specialize TArray<Char> > (note the space between the two >). In mode Delphi you need to declare the array specialization separately (that solution can of course be done in mode ObjFPC as well with the appropriate specialize placements):

Code: Pascal  [Select][+][-]
  1. type
  2.   TCharArray = TArray<Char>;
  3. var
  4.   myQChar: QChar<TCharArray>;
  5. begin
  6.   myQChar := QChar<TCharArray>.Create([' ', ' ']);
  7. end.

 

TinyPortal © 2005-2018