curl-library
Namespace intrusion "struct type".
Date: Sat, 01 Mar 2014 17:35:27 -0800
Hi,
I see that the intent is to have curl_ and CURL_ namespaces in the
headers
to prevent clashes, which is great.
However, the following breaks the intent slightly:
struct curl_khkey {
const char *key; /* points to a zero-terminated string encoded with
base64
if len is zero, otherwise to the "raw" data */
size_t len;
enum type {
--> ^^^^
CURLKHTYPE_UNKNOWN,
CURLKHTYPE_RSA1,
CURLKHTYPE_RSA,
CURLKHTYPE_DSS
} keytype;
};
In C, structs do not have their own scope, unfortunately, so it's
easy to slip up like this. The above declaration introduces the
identifier "type" into the file scope, in the struct/enum tag
namespace.
"enum curl_hkey_type" or something would be better.
I found this right away, bringing curl into a project that has its
own "enum type" (which it is entitled to do since it isn't a library
for wide re-use).
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-02