Hi,

I am a bit struggling with what should be fairly simple. I have a pchar
where I am adding and removing characters. What I did so far is to allocate
new memory every time and copying the source pchar over to a new one to
append or delete a character. This required two helper variables in order
to allow for the swap. This does not seem to be very efficient to me and I
was wondering if I am missing anything?

What also confused me in the beginning that assigning a string to a pchar
automatically assigns memory for that pchar. Is there a way to control
this? e.g. to switch this off and generate a compiler error or runtime
error when this happens? I'd like to prevent runtime errors or memory leaks
instead.

Thank you very much!

Rgds, Darius
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to