User forums > Nightly builds

The 01 october 2006 build is out.

<< < (2/4) > >>

sque:

--- Quote from: killerbot on October 02, 2006, 07:30:43 am ---actually it is correct, as long as you don't say using namespace MySpace; the functions are not in the scope of the compiler (yes, saying compiler here, because it's c++ feature). In such a case you have to specifcy manually like : std::cout.  So more or less it's a good thing the CC is also hiding it.

--- End quote ---

Sry I didn't understand :shock: (no offend, just my english isn't that good)...  Is there a specification that says "using namespace" has effect only in the scope of file that is declared? Because at least with gcc, that isn't true. You can include other files that specify "using namespace" and this have effect at the end-file too.

mandrav:

--- Quote from: sque on October 02, 2006, 07:35:42 am ---Sry I didn't understand :shock: (no offend, just my english isn't that good)...  Is there a specification that says "using namespace" has effect only in the scope of file that is declared? Because at least with gcc, that isn't true. You can include other files that specify "using namespace" and this have effect at the end-file too.

--- End quote ---

No, there's no such specification. It's just that adding "using namespace" inside header files is considered bad practice. Think about it: if you do that in a header then all files including it, directly or (god forbid) indirectly, will be using that namespace too. This is namespace littering and is what namespaces were invented to avoid ;).

CC doesn't parse included files for "using namespace" keywords.

sque:

--- Quote from: mandrav on October 02, 2006, 08:42:08 am ---No, there's no such specification. It's just that adding "using namespace" inside header files is considered bad practice. Think about it: if you do that in a header then all files including it, directly or (god forbid) indirectly, will be using that namespace too. This is namespace littering and is what namespaces were invented to avoid ;).

CC doesn't parse included files for "using namespace" keywords.

--- End quote ---

Yeah, probably you are right about my programming tactics, and maybe I 'll change them. But its different what should everyone do and what the compilers can do. What am I saying is, if compilers DO parse recursively for "using bla bla", why CC must be limited?
In my opinion it should be parsed, although I may never use it in the future as your arguments where good enough :P

mandrav:

--- Quote from: sque on October 02, 2006, 09:46:17 am ---Yeah, probably you are right about my programming tactics, and maybe I 'll change them. But its different what should everyone do and what the compilers can do. What am I saying is, if compilers DO parse recursively for "using bla bla", why CC must be limited?
In my opinion it should be parsed, although I may never use it in the future as your arguments where good enough :P



--- End quote ---

I am not criticizing your programming practices. Anyway, CC doesn't parse "using" directives in the parsing stage because it would add unnecessary complexity in the parsing process. Not that it's impossible, it just would add a lot of complexity. I chose to leave this out and concentrate on more important things/bugs instead. It might be added/fixed sometime in the future but I wouldn't hold my breath ;).

sque:
Ok I understand. So I 'll file it at the bugzilla, just to not be forgotten in the future. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version