curl-library
Re: CURLcode_strerror
From: Ben Greear <greearb_at_candelatech.com>
Date: Fri, 05 Mar 2004 12:17:11 -0800
Date: Fri, 05 Mar 2004 12:17:11 -0800
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.
This, for instance, might be a bad idea because the size of num
and msg may differ across different architectures or compilers:
enum blah {
one,
two
};
struct msg {
blah num;
char id;
...
};
Ben
-- Ben Greear <greearb_at_candelatech.com> Candela Technologies Inc http://www.candelatech.comReceived on 2004-03-05