Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One more question on the book... #5

Closed
eugeneloza opened this issue Feb 23, 2017 · 2 comments
Closed

One more question on the book... #5

eugeneloza opened this issue Feb 23, 2017 · 2 comments

Comments

@eugeneloza
Copy link
Contributor

eugeneloza commented Feb 23, 2017

Hi, Michalis!
I'm working on 2nd part of proof-reading the text at the moment, and I've ran into a not-very-important question.

In some examples you use the text like:
'Note: '+'strings are automatically managed'
Does it have any specific meaning? What's about automatically managed strings? You mean that they are dynamic strings (unless declared as AnsiString) and are automatically freed when they go out of scope? Or that strings can be both UTF8, UTF32 and other encodings? Or maybe, you meant that concatenation is preformed by plus sign?

@michaliskambi
Copy link
Owner

"string" is the same thing as "AnsiString". At least when compiled with {$H+}, as I advice in all examples (It's a pity that it's not the default mode of FPC, IMHO. Both Lazarus and Castle Game Engine build tool by default pass command-line options to FPC that effectively make all code have {$H+} defined).

By "automatically managed" I essentially meant all those things you mentioned...

  • That they are automatically freed.
  • And automatically allocated (when doing A + B),
  • and reference counted (when doing A := B),
  • and copied-on-write (when doing B[10] := 'a' and "B" had reference count > 1) ...

I didn't want to go into the exact details, as the idea of the AnsiString implementation is that 99% of the time you can just forget about it:)

I did not really think about the automatic encoding management (UTF8 etc.) when writing this, as I didn't use it intensively yet, but yes -- that is also something that happens automatically and it should be something invisible ("just works") to the user.

@eugeneloza
Copy link
Contributor Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants