cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLcode_strerror

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 5 Mar 2004 13:36:24 -0800

On Fri, Mar 05, 2004 at 12:17:11PM -0800, Ben Greear wrote:
> codemastr wrote:
> >>I would prefer to see one unified curl_strerror() function:
> >>
> >>char *curl_strerror(int errorcode, int errortype);
> >
> >
> >That could work, however, is it 100% legal to convert from enum -> int? I
> >could swear that there was a compiler that complained about such things,
> >but
> >I could be mistaken.
>
> A simple cast is fine. It is possible for sizeof(enum-foo) to be different
> than sizeof(int), but so long as you are not dependent on the size of
> storage then you are fine.
[...]

It will work, but it's not the way to do it. The function should be
prototyped as taking an enum if there's no reason not to. It's too easy for
a cast to hide a real problem.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2004-03-05