cURL / Mailing Lists / curl-library / Single Mail


Namespace intrusion "struct type".

From: Kaz Kylheku <>
Date: Sat, 01 Mar 2014 17:35:27 -0800


I see that the intent is to have curl_ and CURL_ namespaces in the
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
                         if len is zero, otherwise to the "raw" data */
     size_t len;
     enum type {
--> ^^^^

     } 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

"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:
Received on 2014-03-02