c9s / r3

libr3 is a high-performance path dispatching library. It compiles your route paths into a prefix tree (trie). By using the constructed prefix trie in the start-up time, you may dispatch your routes with efficiency
http://c9s.github.com/r3/bench.html
MIT License
814 stars 83 forks source link

Make include guards unique #35

Closed elfring closed 10 years ago

elfring commented 10 years ago

I find that include guards like "NODE_H" and "LIST_H" are too short for the safe reuse of your header files. How do you think about to make them unique by appending a kind of UUID?

raniejade commented 10 years ago

Or maybe use a common prefix for the include guards like R3_

elfring commented 10 years ago

How do you think about to reduce the probability for name clashes a bit more?

raniejade commented 10 years ago

I agree that NODE_H and LIST_H are too generic for include guards but using UUIDs is such an overkill IMHO; It looks weird too. Personally I use this format:

// header.h
#ifndef MY_PROJECT_HEADER_H_INCLUDED
#define MY_PROJECT_HEADER_H_INCLUDED

// ...

#endif

The probability of it conflicting with other libraries include guard should not be that high.

c9s commented 10 years ago

I think adding a prefix R3_ will be better. :-)

c9s commented 10 years ago

Fixed in 5a10c82 and 288cdc9

elfring commented 10 years ago

It would have been better to group such renaming into a single commit with a reference for this issue, wouldn't it?

Will the affected include guards get the project prefix at least?