> Hi, > > The following compiles with fpc 2.0.1, but not anymore with fpc 2.1.1. > > Is it a bug in my code (and fpc 2.0.1) or in fpc 2.1.1? > > program Project1; > > {$mode objfpc}{$H+} > > procedure test(l: longint); > begin > end; > > begin > test(longint('')); > end.
You are dependning on the internal storage of constant strings. In 2.0.1 it is an ansistring because of the $H+, compiling with $H- gives an error. Because an ansistring is 4 bytes in 32bit the explicit typeconversion to a 4 bytes longint will work in 32bit mode. In 2.1.1 constant strings are array[0..x] of char. Where only a longint('1234') can be converted. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel