Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Clang: Defending C++ from Murphy's Million Monkeys

Download

Right click “Save as…”

Slides
Were we to craft a Lenox Globe of programming languages, C++ might be followed by a famous cautionary phrase: Here Be Dragons. The language can be complex and daunting to programmers who are often shouldered with the task of writing large, complex programs. Those millions of code monkeys need help to resist Murphy's siren song and navigate C++'s treacherous waters of memory corruption and concurrency bugs.
 
Clang is a C++ compiler platform that tries to address these challenges (among others) across the spectrum of development activities. It provides fantastic diagnostics, static and dynamic program analysis, advanced rewriting and refactoring functionality, and language extensibility. Together with improvements to the language in C++11 these help programmers cope with today's code and write better code tomorrow. Clang also makes it easier than ever before to evolve and evaluate new language features and extensions to make C++ itself better.
 
Through this talk I'll give some background on the Clang compiler, what it does today to make writing C++ better, and how we're using it to help shape the C++ language going forward.

Follow the Discussion

  • Ben HansonBen Hanson

    I just wanted to thank Chandler for his very informative and interesting talk, but mostly for his contribution to the "Ask Us Anything" Q and A.

    Thanks,

    Ben

  • +1.  Chandler's very well-presented and very impressive presentation was the [unexpected] highlight of the conference for me (along with Bjarne's sessions).  I hope the VC compiler team was taking very careful notes.  And I agree that Chandler added a lot to the question panel.  I'm looking forward to following the progress of Clang.

  • I've been wanting to switch over from gcc to clang for about a year or two now. This talk just makes me want it even more but alas it doesn't have good windows support yet Crying

    They do not even provide windows binaries you have to figure out how to compile the thing yourself  Crying and that's not even a good option. Not a simple as loading the solution file and press 'build solution' button.

     

  • thesaintthesaint

    "They do not even provide windows binaries you have to figure out how to compile the thing yourself"

    You find the binaries here: "http://llvm.org/releases/download.html#2.9"
    3.0 is missing currently though.

    "and that's not even a good option. Not a simple as loading the solution file and press 'build solution' button."

    Is that so ;)? Just download CMake, select the source root of LLVM checkout and click "configure" in its gui. Then just click "generate", open the VS10 solution in your build directory and click build solution. If that's too hard, then I don't have any other suggestions...

  • ISO 14882ISO 14882

    Who else has the impression that Chandler has the voice of Alf of Melmac? :D

  • @thesaint: It's been a while since i last checked that page Embarassed
    From what i remember. i read something about that they will not provide windows binaries in the future due to the devs not having enough experience with windows or something like that. Perhaps i remember wrong.

    I'm not that familiar with linux type compilations. My experience have been that it is messy and complicated and will pollute the windows environmental paths beyond recognition. In other words its better not to even try it because it may not even work and will possible break windows.

    Sounds like good news though. If it really is that simple now.

  • Robert RameyRobert Ramey

    First of all, I want to express my appreciation to the CLang group for making making another C++ compiler. This is a huge job.

    Chandler's talk focused on the unique features of CLang in regards to error messages and warnings displayed during compilation. It's a fact that C++ (in part to it's legacy compatibility) makes it too easy to write ambiguous code or code which does something different than it looks like it does. So this is a useful facility.

    However, I still have a few issues here.

    a) it seems to me that a lot of effort is directed to detecting errors in code written in a style which we would prefer to see going away. That is, it seems that a lot of effort is directed to solving last years problems. Making it easier to write/debug badly written code encourages bad practice. Programmers will use this tool to scan their code and find "bugs" and fix their code to make it work. The real solution would be to scan the code and highlight the code which should be "re-styled". I know this is somewhat ambiguously described, so maybe it's not reasonable to expect the builders of CLang to do this. But I think that's what C++ really needs. I know this is a tall order - but hey - that's why these guys earn the big bucks!

    b) I'm very concerned that he suggested that a lack of resources (people on the project) with experience with windows held back windows versions of this product. This suggests a coupling of between CLang and the OS. A red flag in my opinion. Certainly the signature facilites of CLang - help for error characterization and syntax checking should be independent of the OS. The only thing that should be coupled to the OS is the implementation of the standard library i/o and memory management facilities.

    Admittedly, the only thing I know about CLang is what I learned from Chandler's talk and from looking at one of the test matrices for a boost library so I totally fine with being proved wrong here.

    Robert Ramey

  • Ben HansonBen Hanson

    @Robert Ramey: From memory (and I may well be wrong) the problem is the proprietary nature of exception handling on Windows. It may well be that the Windows executable format is a further issue.

    My view is that Chandler is hinting to Herb (and others) to help out and also (reading between the lines here) make sure there are no I.P. issues with using the proprietary exception handling.

    It terms of raw details, maybe Walter Bright could help out as he is knowledgeable about these (and many other) issues from implementing both C++ and D on Windows.

    Maybe my comments can provoke Chandler into clarifying..! ;-)

  • Matthieu MMatthieu M

    @Robert Ramey

    There is *much* more than simply parsing C++ to get Windows "compliance".

    There are 2 "big" road-blocks:
    - MSVC uses non-compliant C++, so to work on Windows and with existing Windows libraries CLang must be modified to allow those quirks and extensions
    - The ABI need be emulated faithfully, from data layout to name mangling, from virtual dispatch mechanism to exception propagation, etc... If you read the Itanium ABI, you'll realise how large that is

    Thankfully, the first block is (almost) lifted, thanks to the impressive dedication of Francois Pichet.

    There is work ongoing (notably by r4start) to solve this ABI issue.

    Also, Ruben Van Boxem has been working in parallel to port libc++ to Windows (at least partly).

    The tasks are huge, and I mentionned 3 names; there are several others but not much; and this is *volunteer* work so they don't have much time per week.

    CLang is primarily supported by Apple and Google and they don't seem too interested in Windows support/compatibility: they welcome it, and the developers will help, but they won't lead it.

  • HakimeHakime

    Let's put the credit where it is due here because unfortunately Chandler does not make that clear enough.

    Clang was invented by Apple by the compiler team managed by Chris Lattner. Clang was completely designed and written at Apple before it went open source so Google has nothing to do with the genesis of clang. Clang continues to be mainly developed by Apple as the rest of LLVM and Google only recently jumped in clang development as they started to use it internally for automatic C++ refactoring.

  • Bent Rasmussenexoteric stuck in a loop, for a while

    Cool talk. Finally great diagnostics.

  • Eric AguiarHeavens​Revenge Know Thyself

    To get Clang 3.1 compiling 64-Bit binaries go to: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/4.7.0-2/ 

    Grab both:
     x86_64-w64-mingw32-clang-3.1-2_rubenvb.7z and 
     x86_64-w64-mingw32-gcc-4.7.0-2_rubenvb.7z

    Extract both to the same directory to merge them for libraries & runtime dll's.  Running clang++.exe seems to work excellent with and without the -std=c++0x command line flag to enable C++11 features like range-based for loops and auto. Lambda's aren't yet supported but the GCC included by downloading and merging both supports all new features noted here: http://gcc.gnu.org/projects/cxx0x.html

    Hope this helps some get started quickly with trying Clang.

  • The talk itself is great as the clang compiler itself.

    It's unfortunate though that this and other talks are on obscure and sluggish Channel 9 and not on YouTube where they could get a broader audience.

  • MarshallMarshall

    > Let's put the credit where it is due here because unfortunately Chandler does not make that clear enough.
    > Clang was invented by Apple by the compiler team managed by Chris Lattner

    Well, not exactly.

    LLVM (and clang, the C/C++/Objective-C front end), began as a project at UIUC, headed by Chris Lattner and Vikram Adve back in August of 2000.

    Apple hired Chris to head up their LLVM team in (I believe) early 2007, and Doug Gregor (from the U of Indiana) to head up their clang team a couple of years later.

    Apple has put a great amount of effort into LLVM and Clang, but they are not the only company contributing.

    There was a "History of LLVM" session at the LLVM developer's conference in 2007. The video is on youtube.

  • CharlesCharles Welcome Change

    , vitaut wrote

    The talk itself is great as the clang compiler itself.

    It's unfortunate though that this and other talks are on obscure and sluggish Channel 9 and not on YouTube where they could get a broader audience.

    Obscure? Sluggish? Really?

    C

  • SteveSteve

    >LLVM (and clang, the C/C++/Objective-C front end), began as a project at UIUC, headed by Chris Lattner and Vikram Adve back in August of 2000.

    >Apple hired Chris to head up their LLVM team in (I believe) early 2007, and Doug Gregor (from the U of Indiana) to head up their clang team a couple of years later.

    LLVM started at UIUC. Chris was hired by Apple in 2005. Chris started development of clang while at Apple (and for the first few years, development was done almost entirely by the LLVM team at Apple). Chris's resume has a pretty good timeline, for those who are interested.

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.