Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!EE.ECN.PURDUE.EDU!bevis From: bevis@EE.ECN.PURDUE.EDU (Jeff Bevis) Newsgroups: comp.sys.amiga.tech Subject: Re: Fonts and freeing memory Message-ID: <9001161446.AA29551@en.ecn.purdue.edu> Date: 16 Jan 90 14:46:36 GMT References: <145@ccave.UUCP> Sender: daemon@ucbvax.BERKELEY.EDU Organization: Purdue University Engineering Computer Network Lines: 27 In article <145@ccave.UUCP>, root@ccave.UUCP (Juergen Hermann) writes: > >So do something like > > if ((WinFont = (struct TextFont *) OpenFont (&ta)) == NULL && > (WinFont = (struct TextFont *) OpenDiskFont (&ta)) == NULL) { > Abort ("Can't open font\n"); > } Well, I wouldn't do that either, because you can't be sure what the compiler is going to do with your code. You've got two expressions hooked together with a logical 'and' -- now which one will the final code try first? The one on the right? Uh-oh. This is better: If((WinFont=(struct TextFont *)OpenFont(&ta))==NULL) { If((WinFont=(struct TextFont *)OpenFont(&ta))==NULL) Abort("Can't open font\n"); } That way, OpenFont() will always go first. +--------------------------------+--------------------------------------------+ | Jeff Bevis | "But I don't like spam!" | | bevis@en.ecn.purdue.edu | Give me Amiga or nothing at all. | +--------------------------------+--------------------------------------------+