473,486 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

unnamed namespace,

I just want to clarify: Say I have a helper class that is only used in one
translation file (e.g., a predicate class). I don't want the name of this
class to conflict with other class names in other files, so I put it in a
nameless namespace?
Jul 2 '06 #1
1 2000
vsgdp wrote:
I just want to clarify: Say I have a helper class that is only used
in one translation file (e.g., a predicate class). I don't want the
name of this class to conflict with other class names in other files,
so I put it in a nameless namespace?
That's one very important use for unnamed namespaces, yes. Generally,
anything you think of putting in the global scope (or any other scope
that transcends a single translation unit), but don't want to be easily
visible in another translation unit, or potentially conflict with some
other name, belongs in unnamed namespace.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1649
by: Anthony | last post by:
Hello, I have been reading up on unnamed namespaces in the context of hiding classes as mentionned by the GOF Facade pattern description. I was hoping someone could shed some light on this. I...
1
1620
by: marco_segurini | last post by:
Hi, I like to know if this code is legal: namespace { void unnamed_ns(){} } class test
1
2145
by: Marco Jez | last post by:
What are the requirements imposed by the Standard on unnamed namespaces? I mean, is the hidden name guaranteed to be unique across multiple translation units, or only within the declaring...
3
2333
by: Sandy | last post by:
Hi, I have two files as folllows file1.cpp #include<iostream> using namespace std; namespace { void show(); void fun() { cout<<"fun called\n"; } }
2
1256
by: dioscuroi | last post by:
Is there any difference between declaring in unnamed namespace and i global namespace? I can't recognize this p.s: Have a nice day ^_________ -
9
5392
by: Ivan Mascovich | last post by:
Previous posts (and compilers) confirm that class X { friend void Y() ; } ; does not match namespace
3
2584
by: Tomás | last post by:
I have a header file/source file combo. There's approximately five functions in the source file. Only one of the functions should be used by other translation units, so I've defined the other...
9
2296
by: Tom Plunket | last post by:
The project I'm currently on makes heavy use of unnamed structures to represent an "object hierarchy" of a sort. E.g. struct BaseObject { int aMember; int anotherMember; // etc.
3
2259
by: CrazyJohn | last post by:
Hi guys, This is my first time posting question here, if I break any rules, please kindly point out. And I'm really glad to be a part of this community. Here is my question, Our lecturer...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.