What is the name of the namespace in C source If I mix C and C++ source in vc .net?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ruben Rivero

    What is the name of the namespace in C source If I mix C and C++ source in vc .net?

    I have an application in visual c++ . net, which involves both c and c++ source, my question is, which namespace is asigned to c sources?

    I was able to see C variables with intellisense just by writting "::" before the variable name.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    I assume you're using extern "C". C code isn't namespaced, therefore, in C++ code, it is available in the global namespace.

    That's my understanding of it.

    Mark (is not an expert in C)

    Comment

    • Oralloy
      Recognized Expert Contributor
      • Jun 2010
      • 988

      #3
      The global namespace "::" is the correct namespace.

      I don't know about .net, but in standard C++, you need to be certain that your C source code declarations are prefixed with extern "C", or wrapped, like this
      Code:
      extern "C" double myFunc1(int j);
      extern "C"
      {
        int myFunc2(int x, double i);
      };

      Comment

      Working...