Cory Nelson

Back to Profile: PhrostByte

Comments

  • Herb Sutter: C++ Questions and Answers

    I'm Cory.  Thanks for answering most of my questions, Herb.  I asked all of them in the reference of C++ standardization, not in terms of Microsoft's tools, so I'm glad you picked up on that.  Sorry if there was any confusion with my short statement-questions Wink

    Happy to hear that concepts and polymorphic functions are still on the plate.  Thanks for all your hard work -- looking forward to playing with it when compilers catch up.

  • Conversation with Herb Sutter: Perspectives on Modern C++(0x/11)

    @petke that doesn't specify any parameter types, but it also doesn't have any parameters!  I meant to specify parameters, but leave their types inferred.

    Basically instead of

    [](int i) { return i * 2; }

    You would have:

    [](i) { return i * 2; }

    Which would generate a functor that takes a parameter 'i' of any type -- equivalent to this:

    struct func
    {
       template<typename T>
       auto operator()(T i) -> decltype(i * 2) { return i * 2; }
    }; 

    These are called polymorphic lambdas.  They were discussed for C++0x but dropped as it was decided to be too complex to implement in a way compatible with Concepts (which were themselves removed).  I'm hoping to see it in a future standard.

     

  • Conversation with Herb Sutter: Perspectives on Modern C++(0x/11)

    @exoteric: I'm not sure how well the LINQ library would work for C++ because extension methods don't have a good parallel when it comes to iterators, and lambda functions are far more verbose than they are in C#.

    var enumerable = foo.Select(x => x.y).OrderByDescending(y => y.z);

    VS (made as good as I could think)

    auto range = from(foo.cbegin(), foo.cend()).select([](my_struct const &x) { return x.y; }).sort_desc([](my_sub_struct const &y) { return y.z; });

    Now think of all the extra typing you'd have to do for a longer, more complex query with Join() etc. -- it's not nearly as concise.  We don't have anonymous types either, so for some queries things might need to be declared outside of the query.  What I wrote there is certainly doable, though, and would likely perform significantly better than the equivalent LINQ.

    I wish C++0x allowed shorter lambdas that didn't specify parameter types -- it could work if they boiled down to a template functor that takes any argument type.

  • C9 Lectures: Stephan T. Lavavej - Standard Template Library (STL), 3 of n

    shared_ptr is heavier than a GC, but most things don't need to be manually allocated or shared so you should be using it so little that it doesn't matter.

     

    I don't think it would be easy for a C++ GC to reach the performance of the .NET GC, because .NET is so much stricter about what you can do with an object, ie. there's nothing stopping me from holding a pointer to a member of an object and using an offset to compute the actual object's address.  I believe the .NET GC also defragments the heap, seems unlikely with C++.

  • C9 Lectures: Stephan T. Lavavej - Standard Template Library (STL), 3 of n

    Been a long time since I've posted here too Smiley  STL, I'm curious if you know why unique_ptr has array new/delete support but shared_ptr doesn't?

     

    And a slight correction: having the same initialism is fun, but shared_ptr etc. were not added to SGI's Standard Template Library, but to the C++ Standard Library.

  • STL Iterator Debugging and Secure SCL

    *Raises hand as one of those C++ developers that always disables secure scl.  Not only is perf affected, but depending on your usage it can bloat up the binary size quite a bit.

    First things I do when creating a new project:

    #define _CRT_SECURE_NO_WARNINGS
    #define _SCL_SECURE_NO_WARNINGS

    #ifndef _DEBUG
    #define _SECURE_SCL 0
    #endif

    #define NOMINMAX
  • Stephan T. Lavavej: Digging into C++ Technical Report 1 (TR1)

    This video has really nothing new to C++ developers, but I think it is a good introduction to those who use other languages and are thinking of dipping their feet into C++.

    To be a little cliché here, C++'s biggest strength is also its biggest weakness: the shear power of it all.  It typically takes newbies years before they realize the full strength of it and even after that you find yourself learning new useful things all the time.  The result of this is that many will take a quick glance at it, label it overly complex, and proudly tell everyone they meet who mentions it how horrible it is.

    Rarely will newbies be told of its strong benefits (like RAII), and Stephan very clearly explains a lot of them.  Don't get me wrong - C++ is not the be-all-end-all of languages, but it definitely fits in a lot more places than some would give it credit for.

    He does go off on a few tangents, but the meat of the interview is good enough to look past that!
  • Nikola Dudar: STLCLR - STL Development in the Managed World

    Does anyone know if managed C++ is being used in any production products?

    Microsoft seems to be all but ignoring unmanaged development now, continually pounding out this "managed managed managed" mantra for C++.  But I've yet to encounter anything but unmanaged in the wild, so I would be interested to see what managed is being used for.

  • Ken Levy, XML Tools in VS 2005

    So, why don't I see any pure XML project types?  I have an entire static-page website built with XSLT.  Using a C# project to house it seems a little like overkill.
  • Dare Obasanjo - What is the biggest ​mispercepti​on of XML?

    ktegels wrote:
    Did anybody else think it was wierd to hear the alarm chimes during this? Made Dare seem even more powerful and ominous.


    It was a truck backing up, not alarms.