Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to avoid "opcode 'conv.ovf.i' -- overflow will not throw exception"?

68 views
Skip to first unread message

Allen Dang

unread,
Jun 30, 2009, 3:51:00 AM6/30/09
to

Hi,

I got this warning "opcode 'conv.ovf.i' -- overflow will not throw
exception" at each place where I create a new byte array with dynamic
length.

For example:

byte[] byteArray = new byte[streamLength];

What should I do to avoid this warning? Or what's the safe way to allocate a
dynamic byte array?

Thanks
Allen Dang

dumb...@gmail.com

unread,
Nov 23, 2013, 10:05:54 AM11/23/13
to
Four and-a-bit years after the question I just stumbled across the answer over on the GHI forum: https://www.ghielectronics.com/community/forum/topic?id=3899

Try

byte[] byteArray = new byte[(int)streamLength];

to cast the long to an int before using it as the size of the new byte array.
0 new messages