Is this an error?

Stewart Brodie stewart.brodie at pace.co.uk
Tue May 23 09:08:47 BST 2000


In message <01kUVAA7mXK5Ew4H at mk-net.demon.co.uk>
          Tony van der Hoff <OSLib at mk-net.demon.co.uk> wrote:

> Please tell me I'm wrong on this:
> 
> In core.adfs.swi we have:
> 
> SWI ADFSDiscOp_ReadSectorsViaCache = (NUMBER 0x40240,
>       ENTRY (R1 # 9 "Reads sectors of a disc using the RMA cache", R1 |
> ..Bits: flags,
>             R2 = FileCore_DiscAddress: disc_addr, R3 = .Ref .Data: data,
>             R4 = .Int: size, R6 = .Int: cache_handle),
>       EXIT (R2 = FileCore_DiscAddress: next_disc_addr,
>             R3 = .Ref .Data: next_data,
>             R4! = .Int: unread, R6 = .Int: cache_handle));
> 
> Which is translated into:
> 
> extern os_error *xadfsdiscop_read_sectors_via_cache (bits flags,
>       filecore_disc_address disc_addr,
>       byte *data,
>       int size,
>       int cache_handle,
>       filecore_disc_address *next_disc_addr,
>       byte **next_data,
>       int *unread,
>       int *cache_handle);
> 
> 
> Now, it appears that cache_handle is both an int and an int*, which I
> don't think is quite right. 
> 
> A nasty twist to this is that Norcroft doesn't fault it on compiling
> test.c, but GCC does. 
> 
> Am I going mad, or is this a bug? I count 14 further instances of reuse
> of parameter names in function definitions in various parts of the
> library.

Can't be bothered to look it up in the standards documentation right now, but
as far as compilation goes, the names used for formal parameters in
declarations are completely irrelevant.  Of course, in OSLib, the
declarations serve a double purpose (declaration and documentation) which
makes it harder to accept duplicate names like that.

I would recommend changing the definition to call the latter an
out_cache_handle for want of a better name.

-- 
Stewart Brodie, Senior Software Engineer    (Views expressed are my own and
Pace Micro Technology PLC                   not those of my employer)
645 Newmarket Road
Cambridge, CB5 8PB, United Kingdom         WWW: http://www.pacemicro.com/



More information about the oslib-team mailing list