LWN.net Logo

LLVM 3.0 released

LLVM 3.0 released

Posted Dec 13, 2011 18:39 UTC (Tue) by dgm (subscriber, #49227)
In reply to: LLVM 3.0 released by daglwn
Parent article: LLVM 3.0 released

> Of course C++ is more complex than C. It's more powerful.

Both are Turing-complete, and thus are equivalent in power (as in what you can write with them). Maybe you wanted to use the term "expressive", but that's not very well defined (http://en.wikipedia.org/wiki/Comparison_of_programming_la...). In fact, according to that article, Python, Smalltalk and Perl are more expressive than C++ (and much more than C).


(Log in to post comments)

LLVM 3.0 released

Posted Dec 13, 2011 20:17 UTC (Tue) by nybble41 (subscriber, #55106) [Link]

Both C and C++ are Turing-complete[1], but AFAIK only C++ has a built-in Turing-complete metaprogramming interface at compile time in the form of templates. That can reasonably be considered an extra measure of power. (Retaining one's sanity while attempting any complex computation with C++ templates is left as an exercise for the reader.)

[1] See also: "Turing tarpit" <http://en.wikipedia.org/wiki/Turing_tarpit>

LLVM 3.0 released

Posted Dec 13, 2011 21:27 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

> only C++ has a built-in Turing-complete metaprogramming interface at compile time in the form of templates

Haskell has Template Haskell[1][2] (it's an extension, but since GHC is pretty much the only compiler for Haskell, that's pretty much moot).

[1]https://en.wikipedia.org/wiki/Template_Haskell
[2]http://www.haskell.org/haskellwiki/Template_Haskell

LLVM 3.0 released

Posted Dec 13, 2011 21:49 UTC (Tue) by nybble41 (subscriber, #55106) [Link]

Sorry, I didn't mean "only C++" in that sense. I was only considering C and C++. Other languages do have decent metaprogramming facilities as well, some (IMHO) much better than C++ templates. Lisp macros, for example, or Scheme's syntax expanders. D's more flexible template system ranks highly as well, though the syntax isn't quite as consistent and it relies on parsing generated strings, rather than constructing syntax objects directly.

LLVM 3.0 released

Posted Dec 14, 2011 1:14 UTC (Wed) by dgm (subscriber, #49227) [Link]

Very interesting reading. I came to the conclusion that C++ templates could be considered a meta-Turing tarpit.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds