[hullo, I am c fan from poland, deep involved
in the spirit of c and structural coding,
From few years I am working and thinking about
some way of c language improvements. Sorry for
my weak english]
Improving C is rather a waste of time, because the big improvements that really
move the productivity lever give rise to a different kind of language.
I want to say few words about some thing
I think it is wrong in c linking system
(as far as i know that bug is present in c
linking system at all)
Substantial changes to the linking system require moving "mountains", because
they are entrenched deeply into the toolchains that build big systems.
If you change the C linking system, you end up with a different language,
and the existing linking system does not go away.
There are already langauges with better linking systems; so you can just use
them.
On a 'compiler' (source) level, there is not
such thing as global function or variable -
the scope of symbol is limited to scope of
visibility of its declaration -
C has the notion of external linkage. This is part of the language. Certain
declarations introduce names in such a way that they are known among
translation units, not just within a translation unit.
(Of course, they still have to be declared in other translation units in order
to be visible there, so you have a valid point about scope. But lexical scope
is not all there is to visibility.)
but on linker level (as far as I heard
about it) linkers always try to link any
obj module with any other given module
- so it leads even to conflicts of symbols
not present on source level -it is obviously wrong
C++, an improved dialect of C that's been in development for some three
decades now, addresses this with namespaces.
In C, a translation unit can have private global names thanks to internal
linkage, but two modules cannot share private names that are not also visible
to all other modules.
In C++, two (or more) translation units can share private names via
namespaces, which are named containers of symbols.
So there is an improved C dialect in which the problem has been solved.
That dialect is used by a large number of programmers and has been throughs
several rounds of ISO standarization.
The problem with most people who want to improve C is that they tend to reject
other people's work such as like C++.
"I don't want any of those improvements from other people! That is not
C any more, but some bastardized language which sucks because <insert
reasons here>. I want only C, plus a couple of my own ideas,
and nobody else's, that's all!"
Problem is that C plus a couple of your ideas also creates a forked dialect,
just like C++. The only difference is that C++ is much farther along
in development.
Linker should not to try link everything with
everything but they should to be able to accept
some info about what module to link with
what other module (it would be obvious
If you're going to discuss linkers rather than the language, then
survey what is out there.
Linkers exist which have this capability. For instance on GNU systems with ELF
libraries, you can link a shared library with -Bsymbolic. This will resolve
all internal references *within* the library, so that when the library is
loaded, its references can no longer be hijacked to definitions outside of the
library.
Moreover, you can use linker scripts to precisely control which external
symbols are actually exported from the library, made visible to the attaching
clients. This symbol visibility can even be organized into named "version
nodes". So for instance programs compiled against an old version of the
library can see a different definition of a symbol, compared to programs
compiled against the new version, allowing for precise backward compatibility
support.
The technology exists, but is outside of the C language.