eteran / c-vector

A dynamic array implementation in C similar to the one found in standard C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reserved namespace issues

E5ten opened this issue · comments

commented

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>.

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.

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

Fixed!