🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2780

Re: Fonts and freeing memory

#2780
From: Jeff Bevis
Date: Tue, 16 Jan 1990 14:46
27 lines
1507 bytes
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. |
+--------------------------------+--------------------------------------------+
Technical Details
Message-ID: <9001161446.AA29551@en.ecn.purdue.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!EE.ECN.PURDUE.EDU!bevis
References: <145@ccave.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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