Thread overview | |||||
---|---|---|---|---|---|
|
April 16, 2014 How can I simulate java's final variable in C++? | ||||
---|---|---|---|---|
| ||||
How can I simulate java's final variable[1] in C++? But without an extra bool in the struct itself because it must have a fixed-size length which I use with #pragma pack(1) to prevent compiler to add padding. Is it possible? [1]: http://en.wikipedia.org/wiki/Final_%28Java%29#Final_variables |
April 16, 2014 Re: How can I simulate java's final variable in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to asman | On Wednesday, 16 April 2014 at 20:38:40 UTC, asman wrote:
> How can I simulate java's final variable[1] in C++? But without an extra bool in the struct itself because it must have a fixed-size length which I use with #pragma pack(1) to prevent compiler to add padding. Is it possible?
>
> [1]: http://en.wikipedia.org/wiki/Final_%28Java%29#Final_variables
After see the date of last posts I hope someone still access this thread and see my message. :(
|
May 22, 2014 Re: How can I simulate java's final variable in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to asman | On Wednesday, 16 April 2014 at 20:42:54 UTC, asman wrote:
> On Wednesday, 16 April 2014 at 20:38:40 UTC, asman wrote:
>> How can I simulate java's final variable[1] in C++? But without an extra bool in the struct itself because it must have a fixed-size length which I use with #pragma pack(1) to prevent compiler to add padding. Is it possible?
>>
>> [1]: http://en.wikipedia.org/wiki/Final_%28Java%29#Final_variables
>
> After see the date of last posts I hope someone still access this thread and see my message. :(
Familiar with C++'s 'const' system? That's pretty much Java's final, only taken much further.
I don't know what you're talking about with 'extra bool in the struct' though.
|
Copyright © 1999-2021 by the D Language Foundation