Article View: comp.sys.amiga.tech
Article #2781Re: Fonts and freeing memory
From: Louis A. Mamakos
Date: Wed, 17 Jan 1990 01:34
Date: Wed, 17 Jan 1990 01:34
29 lines
1525 bytes
1525 bytes
In article <9001161446.AA29551@en.ecn.purdue.edu> bevis@EE.ECN.PURDUE.EDU (Jeff Bevis) 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?
According to my K&R, first edition in Appendix A "C Reference Manual",
section 7.11:
7.11 Logical AND operator
{\it logical-and-expression:
expression && expression}
The && operator groups left-to-right. It returns 1 if boths its
operands are non-zero, 0 otherwise. Unlink &, && guarantees
left-to-right evaluation; moreover the second operand is not
evaluated if the first operand is 0.
So the example code posted works just fine.
louie
Technical Details
Message-ID:
<1990Jan17.013417.20587@haven.umd.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!aplcen!haven!sayshell.umd.edu!louieReferences:
<145@ccave.UUCP> <9001161446.AA29551@en.ecn.purdue.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!aplcen!haven!sayshell.umd.edu!louie From: louie@sayshell.umd.edu (Louis A. Mamakos) Newsgroups: comp.sys.amiga.tech Subject: Re: Fonts and freeing memory Message-ID: <1990Jan17.013417.20587@haven.umd.edu> Date: 17 Jan 90 01:34:17 GMT References: <145@ccave.UUCP> <9001161446.AA29551@en.ecn.purdue.edu> Sender: usenet@haven.umd.edu (USENET News Posting) Organization: The University of Maryland, College Park Lines: 29