On 27 May 2006, at 21:54, L505 wrote:
Note that the setlength will generate exactly the same code as the
'last3[0]:=chr(3);' statement, so it's better to keep the setlength
(in case the string would ever become an ansistring, or just for
readability)
I didn't think the compiler would let you
> On 27 May 2006, at 09:46, Arne Hanssen wrote:
>
> >> setlength(last3, 3);
> >> last3[1]:= filename[length(filename)-2];
> >> last3[2]:= filename[length(filename)-1];
> >> last3[3]:= filename[length(filename)];
> >
> > As already explained, you must tell 'last3' its length. As you
> > al
On 27 May 2006, at 09:46, Arne Hanssen wrote:
setlength(last3, 3);
last3[1]:= filename[length(filename)-2];
last3[2]:= filename[length(filename)-1];
last3[3]:= filename[length(filename)];
As already explained, you must tell 'last3' its length. As you
already
are using a somewhat "
L505 wrote:
> I'm lacking some memory concept here. Below program doesn't work unless
> setlengths
> are called first on the shortstrings.
>
> setlength(last3, 3);
> last3[1]:= filename[length(filename)-2];
> last3[2]:= filename[length(filename)-1];
> last3[3]:= filename[length(filename)]
On 26 May 2006, at 19:35, L505 wrote:
The length bytes of those shortstrings aren't initialised if you
don't do setlength(). It has nothing to do with memory allocation,
but with initialisation.
Learn something new today - I unfortunately don't have a
turbopascal background and in
this case
> > var
> > filename: string;
> > last3: string[3];
> > last4: string[4];
> >
> this is not short strings
> use
> last3: shortstring[3];
In delphi 5 and FPC in objfpc mode it doesn't accept that.
___
fpc-pascal maillist - fpc-pascal@lists.fre
> > I'm lacking some memory concept here. Below program doesn't work
> > unless setlengths
> > are called first on the shortstrings.
> >
> > program Project1;
> >
> > {$mode objfpc}{$H+}
> >
> > var
> > filename: string;
> > last3: string[3];
> > last4: string[4];
> > begin
> > filename:= '
On 26 May 2006, at 14:10, L505 wrote:
I'm lacking some memory concept here. Below program doesn't work
unless setlengths
are called first on the shortstrings.
program Project1;
{$mode objfpc}{$H+}
var
filename: string;
last3: string[3];
last4: string[4];
begin
filename:= 'test';
L505 napisaĆ(a):
I'm lacking some memory concept here. Below program doesn't work unless
setlengths
are called first on the shortstrings.
program Project1;
{$mode objfpc}{$H+}
var
filename: string;
last3: string[3];
last4: string[4];
this is not short strings
use
last3: shortstring[
I'm lacking some memory concept here. Below program doesn't work unless
setlengths
are called first on the shortstrings.
program Project1;
{$mode objfpc}{$H+}
var
filename: string;
last3: string[3];
last4: string[4];
begin
filename:= 'test';
filename:= filename+ 'ing.pas';
setlength
10 matches
Mail list logo