🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem with OpenLibrary() under 2.0

#7390
From: Brian Jackson
Date: Tue, 11 Dec 1990 15:16
36 lines
1830 bytes
In article <NJ.90Dec10213112@magnolia.Berkeley.EDU> nj@magnolia.Berkeley.EDU (Narciso Jaramillo) writes:
>In article <9012101903.AA146539@vttcf.cc.vt.edu> fmcphers@VTTCF.CC.VT.EDU (Frank McPherson) writes:
>
>> [...]
>> void OpenLibrary();                            
>  ^^^^
>> if (!(IntuitionBase = (struct IntuitionBase *) 
>>    OpenLibrary("intuition.library")))          
>> [...]
>
>> Manx 5.0d tells me that there's an invalid type conversion
>> in the if statement, right on the second close paren after the actual 
>> OpenLibrary() call.
>
>You're declaring OpenLibrary() as void, then using its return value--strictly
>a no-no.  It should be declared as struct Library *OpenLibrary().  Also, you
>should put the 0L back in the call to OpenLibrary.
>
Well, yes and no. It should be

void *OpenLibrary() ;   /* a pointer to void */

This is ok as void pointers can be cast to/from other types (see page
199 of the ANSI K&R)
 
Manx 5.0 now defaults to 32-bits so the 0L is not required any more
(though still a good idea) - a simple '0' will do.

bj

>nj

 -----------------------------------------------------------------------
 | Brian Jackson  Software Engineer, Commodore-Amiga Inc.  GEnie: B.J. |
 | bj@cbmvax.cbm.commodore.com    or  ...{uunet|rutgers}!cbmvax!bj     |
 -----------------------------------------------------------------------
Technical Details
Message-ID: <16447@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!bj
References: <9012101903.AA146539@vttcf.cc.vt.edu> <NJ.90Dec10213112@magnolia.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!bj
From: bj@cbmvax.commodore.com (Brian Jackson)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Problem with OpenLibrary() under 2.0
Message-ID: <16447@cbmvax.commodore.com>
Date: 11 Dec 90 15:16:32 GMT
References: <9012101903.AA146539@vttcf.cc.vt.edu> <NJ.90Dec10213112@magnolia.Berkeley.EDU>
Reply-To: bj@cbmvax.commodore.com (Brian Jackson)
Organization: Commodore, West Chester, PA
Lines: 36