git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
David Kastrup <dak@gnu.org>
Date
Sep 23, 2007, 18:30 UTC
Message-ID
<85hcllmdzb.fsf@lola.goethe.zz>
In-Reply-To
<e5bfff550709231105h94d08e2n9b1234e7c1a7e6a8@mail.gmail.com>
"Marco Costalba" <mcostalba@gmail.com> writes:
Show 23 quoted lines
> On 9/23/07, Linus Torvalds <torvalds@linux-foundation.org> 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
Previous: Marco CostalbaNext: Marco Costalba
Message 26 of 34 in “C++ *for Git*”
  1. Dmitry KakurinSep 22, 2007
  2. David KastrupSep 22, 2007
  3. Johannes SchindelinSep 22, 2007
  4. Marco CostalbaSep 22, 2007
  5. Dmitry KakurinSep 23, 2007
  6. Kyle RoseSep 22, 2007
  7. Miles BaderSep 22, 2007
  8. [OT] Re: C++ *for Git*Kyle Rose, Sep 22, 2007
  9. David KastrupSep 22, 2007
  10. Alex UnleashedSep 22, 2007
  11. Frank LichtenheldSep 23, 2007
  12. David BrownSep 23, 2007
  13. David KastrupSep 23, 2007
  14. Marco CostalbaSep 23, 2007
  15. David KastrupSep 23, 2007
  16. Marco CostalbaSep 23, 2007
  17. Pierre HabouzitSep 23, 2007
  18. Marco CostalbaSep 23, 2007
  19. Nicolas PitreSep 23, 2007
  20. Marco CostalbaSep 23, 2007
  21. David KastrupSep 23, 2007
  22. Marco CostalbaSep 23, 2007
  23. Paul FranzSep 23, 2007
  24. Linus TorvaldsSep 23, 2007
  25. Marco CostalbaSep 23, 2007
  26. David KastrupSep 23, 2007
  27. Marco CostalbaSep 23, 2007
  28. David KastrupSep 23, 2007
  29. Dmitry PotapovSep 23, 2007
  30. David KastrupSep 23, 2007
  31. Robin RosenbergSep 23, 2007
  32. Reece DunnSep 23, 2007
  33. Dmitry PotapovSep 24, 2007
  34. Martin LanghoffSep 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.