Thread overview | |||||
---|---|---|---|---|---|
|
February 20, 2008 Global variables | ||||
---|---|---|---|---|
| ||||
How are global variables accessed? If a function wants to read/write to one, will it get a reference to it or a copy? (I should learn asm :) |
February 20, 2008 Re: Global variables | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saaa | "Saaa" wrote
>
> How are global variables accessed?
>
> If a function wants to read/write to one, will it get a reference to it or a copy?
>
> (I should learn asm :)
All usage of global variables reference the same data. If you want a copy, declare a local variable and copy the value of the global to the local variable.
-Steve
|
February 20, 2008 Re: Global variables | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Ok, thanks.
Using global variables isn't a performance penalty then.
> All usage of global variables reference the same data. If you want a copy, declare a local variable and copy the value of the global to the local variable.
>
> -Steve
>
|
Copyright © 1999-2021 by the D Language Foundation