[fpc-pascal] TStringStream.DataString returns garbage?

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Thu Feb 2 16:26:11 CET 2012


I would vote for a new function on all stream types to allow writing
strings in the expected way. Everybody hits that problem once.

2012/2/1 Lars <noreply at z505.com>:
> Graeme Geldenhuys wrote:
>> On 2 February 2012 00:14, Michael Van Canneyt  wrote:
>>>
>>> Ehm.. this should be S[1], now you're writing the pointer.
>>
>>
>> Thank you. That's what happens if you have too many very late nights
>> programming - sleep deprivation catches up and one overlooks the
>> simple mistakes.
>>
>>
>>
>
> It's actually a common mistake. Also @s vs "s", and @s[1], it can be
> confusing.
>
> It's one thing I don't like about unsafe languages, pointers, and such
> stuff. It's as if we are programming in advanced C, or C++. Common,
> pointer mistakes? this is C? Really? Can't we make it safer? LOL.
>
> What could be done to make this safer? I don't know. What does java do in
> a situation like this? Could we learn from it?
>
> If somehow the compiler could statically check that only s[1] is allowed,
> and not S, that would be good.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list