On 20 November 2014 15:19, Maxime Coste <frrrwww_AT_gmail.com> wrote:
> On Thu, Nov 20, 2014 at 07:56:29AM +0100, anselm_AT_garbe.us wrote:
>> > But regarding the typedefs for structs: C has only a few namespace
>> > features, so lets not dismantle the probably most used one, alright?
>> > "struct stat" can be something different from "stat()"! I like that
>> > namespace thing so much I even use it in C++ (declaring objects with
>> > "class foo object;"). Not that I use C++ all that often, but, you know,
>> > professional obligations and shit.
>>
>> Why do you bring typedefs in correlation with namespaces?
>
> I think you are confusing the C namespaces (struct names are in a different
> namespace than function names) and C++ ones. Markus was talking of the former.
Ok I must have overlooked him referring to explicit 'struct'-qualified
naming vs typedef'ed naming.
Nevertheless I find it very bad practice to use struct printf { ... };
and printf(); side by side. This looks like obfuscation to me.
> By the way, C++ ones have nothing to do with OOP, its just a way of solving
> name clashes, it provides language support for an already existing practice
> in C, where almost every reasonable library will prefix all its external
> symbol with some 'lib_' prefix.
Well, I was a bit unclear in my rant ;) I wasn't suggesting that
namespaces relate from the fact that C++ adopted OO, but rather that
C++ adopted OO whilst also trying to offer non-OOish approaches side
by side. If C++ would use OO only, then class scoping would be fair
enough. But since the language designer required a way to create a
language that supports all language features man kind came up with, he
had trouble to figure out how to offer C++ versions of the same things
that C already offered. namespaces was his answer to the problem of
offering a way to solve global scope name clashes with the C world.
Now the C++ developer was able to use std::bind side by side with
[::]bind of the C world, and another problem vector was born that
keeps C++ developers in business.
Cheers,
-Anselm
Received on Thu Nov 20 2014 - 18:39:55 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 20 2014 - 18:48:08 CET