messagetrans_error_lookup : wrong type

Tony van der Hoff tony at mk-net.demon.co.uk
Sun Jun 3 11:01:28 BST 2001


On 2 Jun 2001, John Tytgat <John.Tytgat at aaug.net> wrote:

> I guess the 3rd argument of :
> 
> > extern os_error *xmessagetrans_error_lookup (os_error const *error,
> >       messagetrans_control_block const *cb,
> >       char *buffer,
> >       int size,
> >       char const *arg0,
> >       char const *arg1,
> >       char const *arg2,
> >       char const *arg3);
> 
> and
> 
> > extern void messagetrans_error_lookup (os_error const *error,
> >       messagetrans_control_block const *cb,
> >       char *buffer,
> >       int size,
> >       char const *arg0,
> >       char const *arg1,
> >       char const *arg2,
> >       char const *arg3);
> 
> needs to be "os_error *buffer" instead of "char *buffer".  No ?
> 

Well, on the face of it, you're right. 

However, even if we, for now, ignore backward compatibility issues, maybe it
would be slightly presumptious to assume that the user will always want to
pass a pointer to a 256-byte buffer. If we did, then we could default |size|
to that number as well. The fact that RISC OS doesn't assume that suggests
that we shouldn't.

On the other hand, I guess most users will want to do exactly what you're
suggesting, so perhaps the best solution would be to provide a new veneer:

extern os_error *xmessagetrans_error_lookup_tobuffer 
      (os_error const *error,
       messagetrans_control_block const *cb,
       os_error *buffer,
       char const *arg0,
       char const *arg1,
       char const *arg2,
       char const *arg3);

Has anyone any alternative/better suggestions (including name of new veneer)?

-- 
Tony van der Hoff         | MailTo:tony at mk-net.demon.co.uk
                          | MailTo:avanderhoff at iee.org
Buckinghamshire, England  | http:mk-net.demon.co.uk



More information about the oslib-user mailing list