Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-03

Re: Is it save to think default value of untouched string is ''?

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

lyh1

But ShortStrings also store the length in string[0]. If I do a append, I think the string will append to string[1]....
So don't assume string are always initialized with null string?

Show quoted text 16 lines
Message: 5 Date: Sun, 7 Mar 2010 00:17:03 +0100 From: Mattias Gaertner Subject: Re: [fpc-pascal] Is it save to think default value of untouched string is ''? To: Message-ID: Content-Type: text/plain; charset=US-ASCII SetLength does not initialize the string characters. ShortStrings are not always initialized. Mattias

Reply by email

Jorge Aldo G. de F. Junior
to lyh1

security rule #1 : never assume anything...

2010/3/7 lyh1 :

Show quoted text 26 lines
But ShortStrings also store the length in string[0]. If I do a append, I think the string will append to string[1].... So don't assume string are always initialized with null string? > > Message: 5 > Date: Sun, 7 Mar 2010 00:17:03 +0100 > From: Mattias Gaertner > Subject: Re: [fpc-pascal] Is it save to think default value of > untouched string is ''? > To: > Message-ID: > Content-Type: text/plain; charset=US-ASCII > > > SetLength does not initialize the string characters. > ShortStrings are not always initialized. > > Mattias _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email