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
Usage of new
keyword changes const-ness properties of variable
#325
Comments
Just using Since you have used I haven't verified what's written above against what's given in the language guide but that's how the compiler works. |
This one must be related: #70. |
Just did a quick test, this compiles fine: main()
{
new a = 5;
new const b = a;
printf("%d", b);
} So they aren't truly compile-time constants, just values that can't be changed after initial assignment. |
|
Seems I misunderstood the semantics of the keywords. Now it's clear, it makes total sense why there is a difference. I also didn't know |
To be fair, this is another of those extreme corner cases most people don't know - I had to do an experiment then to work it out. |
Is this a BUG REPORT, FEATURE REQUEST or QUESTION?:
What happened:
Using a
new const
cell as an array size:Results in:
What you expected to happen:
No error, since the value is
const
, I wouldn't expect the presence ofnew
to change that fact.How to reproduce it (as minimally and precisely as possible):
See above^
Anything else we need to know?:
Omitting
new
from the declaration compiles fine:The text was updated successfully, but these errors were encountered: