eteran / c-vector

A dynamic array implementation in C similar to the one found in standard C++
MIT License
737 stars 109 forks source link

reserved namespace issues #6

Closed E5ten closed 4 years ago

E5ten commented 4 years ago

within some of the macros, presumably to avoid collision with other variables the caller has defined, local variables are declared with names starting with 2 leading underscores. Any identifier with 2 leading underscores is considered reserved namespace, so these should be renamed to avoid that. Some possibilities are a single leading underscore, which is only reserved namespace for global identifiers, not local, or maybe c_vector_<var_name>.

eteran commented 4 years ago

I am aware of that particular rule and understand that those are technically reserved. It is indeed an effort to avoid name collisions, and for practical usages, doesn't seem to actually cause any issues.

However, I am certainly open to your suggestion of making this 100% standards-compliant by fixing the usage of reserved identifiers.

eteran commented 4 years ago

Actually, now that I revisit the code, all the double underscore usages are of local variables that are within tight scopes.

So it may not be necessary at all, even if it does shadow another variable, the compiler should always pick the right one. The ONLY thing that we'd had to watch out for is if someone were to define a macro with a conflicting name. Which is already the case in some spots.

So yea, I'll probably look for a good way to neaten this up

eteran commented 4 years ago

Fixed!