Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-02 Thread Jonas Maebe
On 02 Apr 2011, at 19:36, Jürgen Hestermann wrote: > Jonas Maebe schrieb: > > If you don't want the compiler to interfere with anything you do, do not > > use automated types such as ansistring, unicodestring, dynamic array and > > COM-style interfaces. The whole point of these types is that th

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-02 Thread Jürgen Hestermann
Jonas Maebe schrieb: > If you don't want the compiler to interfere with anything you do, do not use automated types such as ansistring, unicodestring, dynamic array and COM-style interfaces. The whole point of these types is that the compiler will do lots of stuff behind your back, because with

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-02 Thread Jürgen Hestermann
DaWorm schrieb: > IMO, a dynamic array should never be part of a structure that is > passed to BlockWrite in the first place. Not that I use many dynamic > arrays in the first place, but to me they pass over the border between > simple data types (that are fine for BlockWrite) and managed data >

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-02 Thread Jonas Maebe
On 02 Apr 2011, at 18:19, Jürgen Hestermann wrote: > >> I would never expect an assignmet to nil changing anything else than just > >> the value of the pointer. And for (all?) other pointers this expectation > >> is valid. > > That expectation is not valid for any reference counted type (be it

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-02 Thread DaWorm
IMO, a dynamic array should never be part of a structure that is passed to BlockWrite in the first place. Not that I use many dynamic arrays in the first place, but to me they pass over the border between simple data types (that are fine for BlockWrite) and managed data types (that have quite a lo

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-02 Thread Jürgen Hestermann
>> I would never expect an assignmet to nil changing anything else than just the value of the pointer. And for (all?) other pointers this expectation is valid. > That expectation is not valid for any reference counted type (be it a dynamic array, ansistring, unicodestring, COM-style interfaces).

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-01 Thread Jonas Maebe
On 01 Apr 2011, at 18:44, Jürgen Hestermann wrote: > Jonas Maebe schrieb: > >> If you Blockwrite a dynamic array pointer to file (i.e. because it is part > >> of a large record) and read it back later with Blockread then the pointer > >> value is invalid of course. BUT, if you now try to set it

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-01 Thread Jürgen Hestermann
Jonas Maebe schrieb: >> If you Blockwrite a dynamic array pointer to file (i.e. because it is part of a large record) and read it back later with Blockread then the pointer value is invalid of course. BUT, if you now try to set it to nil as in >> DynArray := nil; >> then Free Pascal seems to f

Re: [fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-01 Thread Jonas Maebe
On 01 Apr 2011, at 18:04, Jürgen Hestermann wrote: > If you Blockwrite a dynamic array pointer to file (i.e. because it is part of > a large record) and read it back later with Blockread then the pointer value > is invalid of course. BUT, if you now try to set it to nil as in > > DynArray := n

[fpc-pascal] A warning when Blockwriting/reading dynamic array pointers

2011-04-01 Thread Jürgen Hestermann
I just wanted to post a warning for everybody who wants to (block)write/read dynamic arrays to/from file. All the documentation about dynamic arrays I found only told me what I *can* do with them but none said what I can *not* do. And there was no detailed information about the internal works.