25 June 2014

June 2014 Notes: Fire Phone, CRT Refactoring and the Vasa Ship.

Notes from recent stories that got my attention.

Amazon Fire Phone

Amazon Fire Phone

The spec:

  • Quad-core 2.2GHz processor, Adremo 330 GPU, 2GB RAM
  • 4.7-inch IPS 1,280 x 720 retina display with 315 pixels-per-inch,
  • 13MP rear-facing camera
  • Fire OS 3.5
  • Dual-stereo speakers, tangle-free flat cabled headphones
  • 2400mAh battery

But here is something nice and fresh:

  • Four 120-degree field-of-view front-facing cameras with IR illumination for head tracking for the Dynamic perspective feature.
    • Dynamic perspective gives you a great 3D view. It uses effect called 'negative parallax'. And there is even SDK for that.
    • I wonder what about batter life? Such image processing should take a good chunk of CPU power

Unfortunately it is available only in US right now, costs 650$ and only in at&t.

What do you think? Is this phone really that impressive? Will it change something?

The Great C Runtime (CRT) Refactoring

Link to the original article

  • Can't fix the past:
    • The model of releasing each separate version was cumbersome and generates problems.
    • VS is released more often now.
  • Major architectural changes to the C Runtime going on.
  • Previously each VS version have its own CRT version. Now it will change: there will be one CRT, updated in place, backward compatibility will be provided.
  • Actually not one but three components:
    • VC Runtime,
    • AppCRT and
    • DesktopCRT (used only by desktop, not by mobile)
    • For instance Win Store or Mobile have no console output functionality
  • Maintainability was the main problem.
    • Need for stabilization.
    • Some of the code remember 1980s!
    • Written mostly in od style C with heavy use of preprocessor macros.
    • printf for instance had 142 versions! Its 2,696-line file had 223 conditionally compiled regions of code (#ifdef, #else, etc.), over half of which were in a single 1,400 line function
    • Huge problems with bringing the C99 features to the library.
  • The refactoring process
    • Now compiled as C++ code and used a lot of its features - like templates.
    • Eliminated 75% of the conditional compilation preprocessor directives.
    • The sprintf functions are now up to 8 times faster than they were in previous releases.
    • Bugs elimination before the final release.
    • STL is not affected.

Nice! I hope everything goes fine.

Why C++ Sails When the Vasa Sank?

link to the video and link to the slides

Another Great talk from Scott Meyers !

  • There must me some reason that people are still using C++.
  • In 1992 there were some serious concerns about cpp complexity, everyone wanted to add some feature and standardize.
    • Bjorne said "C++ is already too complicated!"
    • The story of the Vasa ship is a great example how something that looks great on a paper can be spoiled by adding too much 'awesome' features. It can quickly collapse.
    • Surprisingly C++ was/is cool and it is/was very popular. It was the second or the third popular language for around 25 years! So it must be something good about it! Somehow it did not follow the ship's faith and it's still sailing.

The reasons:

  • Probably most important features is "compatibility with C"
    • Lots of people know C, the most popular language (even now!).
  • Generic features - for lots of different problems.
  • Destructor -> RAII. Unique concept for resource management.
    • Story: It is important that if you are designing nuclear bombs you design them correctly! :D
  • STL - only in C++ Alexander Stepanov was able to create it.
  • System programming
    • In Scott's opinion, C++ is best suited for System programming
    • Example: Some companies have lost source code for some important lib, and cpp need to link somehow to it :D C++ is able to do such work.
  • Lots of available compilers - almost everywhere. Sometimes they can be quite crappy, but still they allows you to do your job.
  • Backward compatibility - not a sexy reason, but important. Lots of money were invested in software, so companies would not be happy if it stopped working.
  • Complexity usually hidden, good code is more readable, for user it should be simple, although, for lib developers complex. For instance C++14 more complicated than C++98, but a lot of code got nicer. At least from the user perspective.
  • One of the reason C++ is complicated because we all are all sick! :D

Questions:

  • what about C++ future: Scott said that it will be very important language for next decades! (I hope it will :))
  • D language: It is interesting. The hardest people to convince are, actually, C++ programmers :) It seems that D does not target C++ programmers that much. It tries to find its own way.
  • Cpp preprocessor: it will, unfortunately, not go away. Nobody likes it, but it lets you do your work.
  • ABI proposal from Herb Sutter? - Interesting idea but huge amount of work upfront.
  • Scott mentioned story when he started teaching. At that time he gave C++ max lifetime of 5 years. He was, fortunately, wrong :)
  • Net and GFX - two missing features that he would like to have in the language/STD.

Interested in new blog posts and occasional updates? Please sign up for my free newsletter.

© 2017, Bartlomiej Filipek, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.