Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

C++ - What would happen if two library uses same source code for build

I have doubt is it possible if I built lib1.so using source file common.cppand lib2.so using same source file common.cpp again. Now I want to build my application APP using this two library , My ...
Arun Pal's user avatar
  • 757
-4 votes
2 answers
2k views

How 'using namespace' works in C++

I am trying to understand namespaces in C++. I read that there are two ways of accessing namespace variables and functions. First one is to write using :: and second one is by using using directive at ...
shiwang's user avatar
  • 170
2 votes
2 answers
51 views

Resolving name clashes with builtins in a see also documentation section

I have the following class, with a method that hides (or shadows) a builtin function. I want the documentation to contain a "See Also" section, that links to the builtin function that is hidden. ...
Eric's user avatar
  • 98.1k
1 vote
3 answers
98 views

How to refer to a type defined in a derived class passed as a template argument?

Consider the following example: template <typename T> class A { private: typedef typename T::C C; }; template <typename T> class B : public A<B<T>> { public: typedef T ...
vitaut's user avatar
  • 57.3k
8 votes
1 answer
516 views

Point of instantiation of a template class

Could that code to be compile? #include <iostream> template <typename T> struct TMPL { using TP = typename T::TP; //is CL::TP visible (with T == CL)? }; struct CL { using TP = ...
Denis's user avatar
  • 3,174
0 votes
2 answers
562 views

C++ Custom Header File - Syntax Error C2061: identifier

I've been looking into Syntax Error C2061 for a while now, and I have come to understand that it is often caused by circular dependencies of header files. However, I believe I should've resolved this ...
Christopher Orchard's user avatar
1 vote
2 answers
426 views

Does C++ use static name resolution or dynamic name resolution?

I have been reading about "Name resolution" in wikipedia (Name resolution WIKI) and it has been given in that that C++ uses "Static Name Resolution". If that is true then I couldn't figure out how C++ ...
pasha's user avatar
  • 2,115
7 votes
1 answer
184 views

Differences of the interpretation of a non-dependent construct between definition context and point of instantiation in c++

N4527 14.6 [temp.res]/p8 If a hypothetical instantiation of a template immediately following its definition would be ill-formed due to a construct that does not depend on a template parameter, ...
stackcpp's user avatar
  • 1,295
4 votes
3 answers
4k views

why getenv() can get name resolved without a std::? [duplicate]

getenv() has a C++ implementation which can be included in the header file . So it is a member of namespace std. However, the getenv() function can be get resolved correctly in my code even without a ...
Banchon's user avatar
  • 43
3 votes
1 answer
191 views

Are there different rules regarding ADL or naming clashes with regard to overloaded operators?

I think this example best illustrates my question: namespace N { class C { public: friend bool operator==(const C& c, const C& x) { return true; } ...
odinthenerd's user avatar
  • 5,582
4 votes
2 answers
852 views

How does a java compiler resolve a non-imported name

Consider I use a type X in my java compilation unit from package foo.bar and X is not defined in the compilation unit itself nor is it directly imported. How does a java compiler resolve X now ...
gexicide's user avatar
  • 40.4k
4 votes
1 answer
996 views

c++ namespace resolution ("automatic using" based on arguments?)

When I call a function declared in a namespace from outside this namespace, I usually need to explicitly prefix with the namespace: namespace ns1 { void myfunc(); } myfunc(); // compiler ...
Julien-L's user avatar
  • 5,436
6 votes
1 answer
578 views

Dependent name resolution & namespace std / Standard Library

While answering this SO question (better read this "duplicate"), I came up with the following solution to dependent name resolution of an operator: [temp.dep.res]/1: In resolving dependent names, ...
dyp's user avatar
  • 39.4k
1 vote
3 answers
264 views

namespace detection [duplicate]

I'm trying to write a log library which would use an external tool To make the library more natural to use, i would like to be able to detect the namespace in which cout is used. concretly the ...
tiridactil's user avatar
24 votes
1 answer
10k views

Declaration of method changes meaning of symbol

For the following code: struct foo {}; struct A { typedef foo foo_type; void foo(); }; GCC gives a compiler error: test.cpp:7:14: error: declaration of 'void A::foo()' [-fpermissive] ...
HighCommander4's user avatar
-1 votes
1 answer
63 views

How can I call a member from a templated base class on a templated derived class? [closed]

With this setup: template<int N> struct Base { void foo(); }; class Derived : Base<1> { static void bar(Derived *d) { //No syntax errors here d->Base<1>::...
Eric's user avatar
  • 98.1k
10 votes
3 answers
306 views

Wrong name resolution when parent and inner class have the same name

I have an odd case with Visual Studio 2003. For somewhat legitimate reasons, I have the following hierarchy: class A {}; class B : public A { public: class A {}; }; class C : public B::A {}; ...
Michael Mrozek's user avatar
5 votes
3 answers
4k views

Reserved names in the global namespace

Arising from my answer to Dynamic array of objects in C++ and as a follow up to What are the rules about using an underscore in a C++ identifier?: apparently, names beginning with _ followed by an ...
rerun's user avatar
  • 25.5k
14 votes
3 answers
326 views

The actual result of name resolution in the class template is different from the c++ 03 standard

I test the code in the c++ standard ISO/IEC 14882-03 14.6.1/9 on Xcode 4.1 and Visual Studio 2008. The outputs of the two compiler are both different from the expected result of the standard. The ...
Jeffrey's user avatar
  • 4,566
44 votes
1 answer
6k views

List of C++ name resolution (and overloading) rules

Where I can find a list of the rules that a C++ compliant compiler must apply in order to perform names resolution (including overloading)? I'd like something like a natural-language algorithm or ...
user avatar
0 votes
1 answer
140 views

Templates :Name resolution -->IS this statement is true while inheritance?

This is the statement from ISO C++ Standard 14.6/6: Within the definition of a class template or within the definition of a member of a class template, the keyword typename is not required when ...
user avatar