[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why are people so afraid of globals?
- From: David Manura <dm.lua@...>
- Date: Sat, 10 Jul 2010 01:02:32 -0400
On Fri, Jul 9, 2010 at 7:49 AM, Antonio Vieiro <antonio@antonioshome.net> wrote:
>... C has no namespaces and there's no problem in
> building large applications on top of it, right?
The problems with C header files [1] are well known, and newer
variants like Java/C#/D do not repeat it. windows.h, for example, is
prone to some annoying name conflicts [2]. Design patterns have been
devised to reduce these problems sufficiently to make large
application development do-able. Modern C++ development does use
namespaces [3], although this does not replace header files. Even C
has "static" internal linkage, a type of private namespace, and a
convention is to prefix globals by the library name (e.g. "lua_") and
hope it is unique.
[1] http://en.wikipedia.org/wiki/Header_file
[2] http://lua-users.org/lists/lua-l/2010-01/msg00428.html
[3] http://winterdom.com/dev/cpp/nspaces