From: Antoine Leca Newsgroups: comp.os.msdos.djgpp,comp.lang.c Subject: Re: Functions in struct's... possible? How? Date: Fri, 22 Aug 1997 13:25:17 +0200 Organization: RENAULT Lines: 20 Message-ID: <33FD771D.40FF@Renault.FR> References: <33FCDA5C DOT 2353659F AT execulink DOT com> <01bcaea8$2e22c2a0$e3441ed1 AT crhodes DOT flash DOT net> NNTP-Posting-Host: pc860205.pdj.renault.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Cliff Rhodes wrote: > > Jeff Weeks 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