Mail Archives: djgpp/1997/08/23/17:35:08
Cliff Rhodes wrote:
>
> Jeff Weeks <pweeks AT execulink DOT com> wrote
>
> > char *virt = (char *)malloc(640*480*2);
>
> Did you ever check the return value from malloc()? I think you will have a
> surprise.
To avoid further surprise, I will add an L after 640 or 480.
I know Jeff probably use djgpp (so 32-bits int), but this is just in case.
It doesn't cost a lot of typing or storage, and it can be *very* big help
for someone who tries to port this to plain DOS (where 640*480*2 is -40960,
converted to 24576 when casted to size_t)...
OTOH, it can be spurious on a plateforme where long are 64 bits.
Antoine
- Raw text -