[fpc-pascal] 3.0.0 for 3.0.3
Hi, Why do I need fpc 3.0.0 to build 3.0.3? Shouldn't that be 3.0.2? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] $IFDEF with multiple symbols?
On 02/03/17 20:39, Bo Berglund wrote: Can I use this to make a conditional compilation? {$IFDEF charlie, oscar} main, {$ENDIF} Where I want main to be included if one or both of charlie and oscar are defined symbols. So in effect the condition triggering main would be charlie OR oscar.. {$if defined(charlie) or defined(oscar)} main, {$endif} Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] $IFDEF with multiple symbols?
Can I use this to make a conditional compilation? {$IFDEF charlie, oscar} main, {$ENDIF} Where I want main to be included if one or both of charlie and oscar are defined symbols. So in effect the condition triggering main would be charlie OR oscar.. If not then how else should I include main in the charlie or oscar case but not if both are undefined? The problem comes from making some units shared between different projects... -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC 3.0.2 released!
On 01/03/17 23:38, Bo Berglund wrote: On Wed, 1 Mar 2017 22:04:26 +0100, Jonas Maebewrote: On 01/03/17 21:55, Bo Berglund wrote: Am I still supposed to use 2.6.4 as compiler to build 3.0.2? I am getting an error about the "seed" compiler when I try to build 3.0.2 with a 3.x compiler You have to build it with the previous release, i.e. 3.0.0 The error message I received talked about a requirement for 2.6.4 But I pointed make towards a 3.0.0 ppcarm and it did the build OK. I don't know how that is possible with the official 3.0.2 release sources, since that Makefile does not mention 2.6.4: http://svn.freepascal.org/svn/fpc/tags/release_3_0_2/Makefile.fpc Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Array of const and generics
Am 02.03.2017 14:17 schrieb "Ryan Joseph": > > > > On Mar 2, 2017, at 5:45 PM, Sven Barth wrote: > > > > "array of const" itself should work without problems though mixing the type parameters and the values contained in the array might be problematic (I'd need to test it myself). > > It doesn’t work from my tests. When I'll have the time I'll check whether it's correct that it doesn't work or not... > > However for your specific example case why don't you use "array of T" as a parameter type for the constructor. It would work the same, but would be even more type safe and in the spirit of generics. > > I didn’t even know you could pass a dynamic array as a parameter so I was always using array of const. Thanks, learning more new things again! It's not a dynamic array, but an open array, that's an important difference. You (currently) can't pass a an array constructor ("[...]") to a dynamic array parameter (that will change once we support such array constructors like Delphi does). Check the language reference guide for more details. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Array of const and generics
> On Mar 2, 2017, at 5:45 PM, Sven Barthwrote: > > "array of const" itself should work without problems though mixing the type > parameters and the values contained in the array might be problematic (I'd > need to test it myself). It doesn’t work from my tests. > However for your specific example case why don't you use "array of T" as a > parameter type for the constructor. It would work the same, but would be even > more type safe and in the spirit of generics. I didn’t even know you could pass a dynamic array as a parameter so I was always using array of const. Thanks, learning more new things again! Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Array of const and generics
Am 02.03.2017 10:42 schrieb "Ryan Joseph": > > Is it possible to use array of const inside of generics? > > > Quick example I just typed up. If you specialize the generic the compiler always complains about the type in array of const not being the specialized type. Type casting doesn’t work either because you may have specialized for incompatible types like classes and strings. It would be nice to say: TIntegerCollection.Create([1, 3, 4, 8, 10]) as a way to init the instance. "array of const" itself should work without problems though mixing the type parameters and the values contained in the array might be problematic (I'd need to test it myself). However for your specific example case why don't you use "array of T" as a parameter type for the constructor. It would work the same, but would be even more type safe and in the spirit of generics. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Array of const and generics
Is it possible to use array of const inside of generics? Quick example I just typed up. If you specialize the generic the compiler always complains about the type in array of const not being the specialized type. Type casting doesn’t work either because you may have specialized for incompatible types like classes and strings. It would be nice to say: TIntegerCollection.Create([1, 3, 4, 8, 10]) as a way to init the instance. type generic TCollection = class (TObject) constructor Create (args: array of const); procedure Add (a: T); end; TIntegerCollection = specialize TCollection; constructor TCollection.Create (args: array of const); begin // ERROR: args[0] is not the type we specialized for. can’t typecast either. if args[0].vtype = vtinteger then Add(T(args[0].vinteger)); end; procedure TCollection.Add (a: T); begin end; Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal