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

Chtistopher Yeleighton

Chtistopher Yeleighton giecrilj71pl turtlethere

Niner since 2009

M.Sc. in mathematics, software developer
Forum Thread Replies Latest activity
Tech Off a selector iterator 1
  • Day 1 Keynote - Bjarne Stroustrup: C++11 Style

    (1) Huh? unsigned char c; while(cin>>c) cout<<c<<'\n'; gives exactly what I expect

    (2) The value of (unsigned char)0 *is* 0; not the value of the character '0'

    1. What exactly do you expect?  Moreover, your thought experiment is incomplete, as you have provided no assumptions for the behavior of (cin >> c).  I am sure that our expectations coincide on assumption that cin is empty  Big Smile
    2. But the text form of (unsigned char) 0 is the string "0", not the character '\0'.
  • Day 1 Keynote - Bjarne Stroustrup: C++11 Style

    So, why can’t I read an unsigned char from an input stream?

    When I try to read from "0", I get 060 and not 0 as expected.

    And when I push (unsigned char) 0, I get "\0", not "0" in the output.

  • Herb Sutter: C++ Questions and Answers

    @OS guest:Code and data (like std::cout) in libraries are fully instantiated.

  • Microsoft's Commitment to C++

    The thing is, Microsoft cannot abandon C++ completely because they need a tool to maintain and compile the operating system.  And that rudimentary support seems to be just enough to do that.

  • Microsoft's Commitment to C++

    OK, so when shall we see std::messages implemented?

    David Ching: Before you start praising Qt, try examining whether writing to a Qt output stream succeeds Expressionless

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

    ,STL wrote

    vector<GameEntity> v;

    v.push_back(GameEntity());

    This constructs a temporary GameEntity (that's the GameEntity() expression).  Then, a vector element GameEntity is copy-constructed from the temporary.  Then the temporary is destroyed (temporaries are destroyed "at the semicolon").

    If GameEntity‘s copy constructor has trivial path, there is a workaround, although contrived and against the bitzkrieg convention that objects in C++ should not have an error state: push back a temporary constructed to follow that trivial path and do serious things to v.back() afterwards.

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

    ,STL wrote

    > On the other hand, a Matrix is a fairly general data structure, and if you promoted your implementation to a separate component, you could use it elsewhere.

     

    The Nurikabe grid isn't a mathematical matrix.

    Why not?  It is rectangular and it contains numbers and symbols in the cells.

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

    Am I correct you are using enumerated types to store values outside the declared range of the type?  I admit that C++ already allows this where it allows (Enum()) as a valid expression; however, I would never mix entities like that.  I would rather use the underlying type or, if it is needed for resolution, a wrapper class.

    BTW, I would really appreciate if enumerated types were true compile-type sets of values in C++, with expressions like (wrapping) increments (++e), (--e), (limits<e>) (this one would require compiler magic because builtin types only have min and max as library definitions) and (e = dynamic_cast <Enum> (07)) throwing bad_cast.  Of course, these features can be simulated with TMP, but it takes a lot to write such code (and, even worse, to read it).

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

    , STL wrote

    [giecrilj71pl]
    > And, even if you insist, the interface class should be called Matrix (or, in fact, Grid proper) and use a vector of vectors as an implementation detail.

    My Nurikabe Grid class uses a vector of vectors as an implementation detail. It is strongly encapsulated and nobody outside of the Grid is aware of its presence. I saw, and continue to see, no reason to further encapsulate the Grid's storage. (On the other hand, Region is a nontrivial data structure, which benefits greatly from the partial encapsulation that I gave to it.)

    On the other hand, a Matrix is a fairly general data structure, and if you promoted your implementation to a separate component, you could use it elsewhere.  But then my criticism at your implementation choice would be much more valid, so it was actually clever to hide it Angel

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

    , STL wrote


    > but then, please explain the options for low RAM environments because STL is not an option for various reasons.

    Actually, the STL is extremely good at conserving space.

    Your correctly observed in Installment 1 how the triple A-I-C saves us from having A*C implementations.  However, this only applies to source code, because the object code will contain (up to) A*C implementations (actually A*C*T).  Of course, most code sets do not use all pairs; however, depending on the domain, the object size can skyrocket.  This is not a big problem for algorithms like find, and any algorithms you would type inline off your head, but complex and long template algorithms do exist, e.g. sort.  That was a significant problem for Adobe when they created their image manipulation library.

See more comments…