Errors, bugs, questions - page 2762
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
checked:
OK, works without any compiler warnings
Thanks
You'll laugh, but even that works without any warnings
You'll laugh, but even this works without warnings
you'll laugh too, but it's the way to UB and the way to get the tricky bug on the next builds :-)
int foo=-1;
uchar bar=(uchar)foo; // чему должен быть равен bar ?
checked:
OK, works without any compiler warnings
Thanks
Why is the ArrayInitialize call needed in this case? Why not just write uchar uc[16] = {0xFF}; ?
ArrayInitialize makes sense for dynamically distributed arrays, while here the size is supposedly known at the time of description.
You will laugh, but even this works without any warnings
it's not funny, it's not correct initialization, which you may not understand why you did
it's clear that the high byte will be truncated when casting to uchar
Why do I need ArrayInitialize call in this case? Why not just write uchar uc[16] = {0xFF}; ?
ArrayInitialize makes sense for dynamically distributed arrays and here the size is supposedly known at the moment of description.
won't work
Unprint it, the first element will be 255 and the rest 0, 0, 0, ...
OK, works without any compiler warnings
without a ghosting is normally like this
UPD no, same warning, such a literal is of type ushortOnce again, on a level playing field...
Once again on the spot...
I'm totally confused )
It warns about constants from 128 and 0xFF, but not about int variables with the same values.
Moreover, it doesn't warn about constant -1 int either. Is there some logic in this?
s.s. I guess it's understandable with -1, it's reduced to any unsigned by max value according to the rules.without a ghost like that.
UPD no, also a warning, such a literal is of type ushort'\xFF'
?? wow... in 4 (it's open on occasion) rolls.
void OnStart()
{
ushort foo='\xFF';
}
PS/ when on occasion, whoever has a web site near you, give them a slap on the wrist.