By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,326 Members | 2,726 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,326 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Oct 28 '10 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
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)
Oct 28 '10 #2

Oralloy
Expert 100+
P: 983
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
Expand|Select|Wrap|Line Numbers
  1. extern "C" double myFunc1(int j);
  2. extern "C"
  3. {
  4.   int myFunc2(int x, double i);
  5. };
Oct 28 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.