int? like this one?
int arr[18446744073709551615];
ask your platform.
shitty exam question
That is, 1.84 x 10^ 20 x 4 bytes if int is 4 bytes which is ~736000000 terabytes
why should declaration care about runtime env ?
It should not but afaik it's a fixed length array, declaration is definition. Also declaring such large arrays will overflow stack.
well that is -1 in signed integers iirc... but anyways stack can't be anywhere that big so compiler will deny it in code gen pass.
probably, but i haven't tried.
On todays computer. From the language construction (c++ 14) it is the type of size_t. Does standart prohibit that kind of thing ?
standard shouldn't say anything about it from what I know C++ standards go to extreme lengths to not talk about implementation details
well that's not always true
Some of the UB they have is them refusing to talk about stuff which is implementation defined, can't think of a concrete example atm. Also i don't think C++ standard defines an upper bound on the largest fixed sized array.
stack size can is limited to platform object size no system i know of supports that much object size hence the conclusion.
Thats why stack size is platform dependent (which i meant by runtime env). On 16 bit Segmented even you cannot allocate > 1MB.
Обсуждают сегодня