fushar / testerdream

A TopCoder Arena plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid sizeof(long) in generated code

fushar opened this issue · comments

Copying from andrey.v's post:

For SRM 562 Div. 1 easy problem, the plugin generates

long long __expected[] = {3, 4, 3 };
_expected = vector<long long>(__expected, __expected+sizeof(__expected)/sizeof(long));

But, obviously, long is not long long, and there is a warning:

PastingPaintingDivOne.cpp:100:89: warning: array subscript is above array bounds [-Warray-bounds]

It would be better to have

sizeof(__expected)/sizeof(__expected[0])