Jonas Maebe schrieb: > Florian Klaempfl wrote on Tue, 13 Oct 2009: > >> When messing with pointers you've to know what to write because pointers >> allow unlimited access to internal data structures. Sorry, but I can't >> help you if you guess wrong while playing with dangerous stuff (and the >> original poster did so: using move is a dangerous operation) instead of >> reading the manual. > > I think that "all pointers can be indexed as arrays" can easily cause > accidentantal errors though. I can't find it anymore, but I remember > Pierre once fixed a bug in the compiler sources itself where someone > accidentally used move(pstring_var[1],...) instead of > move(pstring_var^[1],..). That at least was not a case of not > understanding how pointers work, but a simple case of a typo which > couldn't be caught anymore by the compiler due to this extension. >
What is the alternative? Declare things like tchar = array[0..maxint] of char; pchar = ^tchar; ? Small typo, move(p,... instead of move(p^,... and things break as well besides unneeded and wrong range check code being generated etc. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal