Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Delphi class vars have global or thread local storage?

My guess is that class variables ("class var") are truly global in storage (that is, one instance for the entire application).

But I am wondering whether this is the case, or whether they are thread in storage (eg similar to a "threadvar") - once instance per thread.

Anyone know?

Edit: changed "scope" to "storage" as this is in fact the correct terminology, and what I am after (thanks Barry)

like image 308
Graza Avatar asked Sep 17 '08 11:09

Graza


1 Answers

Class variables are scoped according to their member visibility attributes, and have global storage, not thread storage.

Scope is a syntactic concept, and relates to what identifiers are visible from where. It is the storage of the variable that is of concern here.

like image 161
Barry Kelly Avatar answered Sep 26 '22 01:09

Barry Kelly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!