Re: [OT] Re: C++ *for Git*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Marco Costalba" <mcostalba@xxxxxxxxx> writes:

> On 9/23/07, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> There are a few features of C++ that I really really like. For example, I
>> think the C preprocessor is absolutely horrid, and a preprocessor that is
>> built into the language - and integrates with the syntax - would be
>> wonderful. And while C++ doesn't improve on that, at least templates are
>> an example of something like that. Not perfect, but that's the kind of
>> feature that C really would like.
>>
>
> Yes, I really agree. IMO templates are the thing that more resembles
> procedural programming, a common way of using them is to split data
> structures (containers) from functions that operates on them
> (algorithms). I find them very similar to the struct + functions
> classical approach of C.
>
> And BTW
>
> template <typename T>
>
> is the thing in C++ that more remembers me of opaque pointers and
> their use in C, the difference is that the first is fully type
> checked.

Not really.  The difference is that the first generates new (and
optimized) code for every type which is something you can only do
using macros in C.  Class programming is similar to opaque pointers
(in particular concerning the generated code) but templates are really
more like macros, as their instantiation generates specialized code,
not at all like the handling of opaque pointers.

While I tend to agree that templates are probably the one thing
actually worth having, it was stupid to lift the restrictions syntax
along with the concept of generics from the Ada shop.  Borrowing
syntax along with features is such a Perlesque approach.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux