Friday, August 03, 2018

A Better C?

30 years ago, on its August 1988 edition, Byte Magazine (ask your parents) published a feature article by Bjarne Stroustroup about C++. Titled A Better C?  the article introduces C++ to the C community. In addition it introduces OOP concepts and data abtraction. In that article, Stroustroup advocates the use of C++ to overcome C weaknesses without losing its strengths.


1988 also saw the birth of Zortech C++ the first true C++ compiler for MS-DOS (ask your grandparents). There is a Zortech C++ ad in the same edition:




That edition also includes a story by Dennis Ritchie and Brian Kernigham about the state of C and the then forthcoming of the first ANSI C standard.

August was the month of the traditional C edition of Byte (other magazines also followed the tradtion).

The full edition of Byte August 1988 can be found at archive.org




Friday, June 02, 2017

Visiting an old friend

In the (not) good old days of single-user single-process MS-DOS TSR programs were a kind of magic wish: have more than one program running at same time.

Companies created TSR utilities. I can remember of Borland Sidekick and Norton Guides, among others.

Of course I couldn't leave behind. Around 1990 I created my own TSR program: TASCII. An ASCII table very useful for... me only.

I based my implementation on the excellent Al Stevens' Extending Turbo C Professional book.

Recently I attempted, just for the fun, to bring back TASCII to life again.

I began with the DOSBOX MS-DOS emulator. For the compiler I used Turbo C 2.01 which Borland (now Embarcadero) made available for free, years ago. Unfortunately I hadn't the full source code for the Extending.. book. So I had to borrow it from openlibrary.org and type the missing parts.

Well, here it is (for the real nostalgia DOSBOX has a CGA mode):











Who needs a resident ASCII table these days? But it is nice to see an old friend again.

(If you are also insane I can provide you with the binary).

Wednesday, October 14, 2015

C++ turns 30

30 years ago in October 14th, 1985, the very first edition of The C++ Programming Language was published together with the release of CFront 1.0 (the first C++ compiler)

Bjarne Stroustrup on the 30th anniversary of Cfront (the first C++ compiler)

Oct. 14, 1985: C++ Adds to Programming


Monday, October 12, 2015

Boost and ICU build scripts for MinGW-w64

My MinGW distro is long gone now. However I still privately use a MinGW-w64 toolchain to test and study C++.

I have kept two scripts to build both ICU and Boost so I can have Boost libraries always available.

The scripts are for the latest version of both libraries. Build first ICU, uncompress the generated package and then build Boost.

You will need:

Steps:

  • Create a directory, eg, C:\mingw-build;
  • Under this directory create other three directories: dest, scripts and sources;
  • Copy both icu-55.1-w64-amd64.sh and boost-1.59.0-w64-amd64.sh to the scripts directory;
  • Download icu4c-55_1-src.tgz and icu4c-55_1-data.zip from ICU site to the sources directory;
  • Download boost_1_59_0.tar.bz2 from Boost site to the sources directory;
  • Download the MinGW-w64 toolschain and uncompress it to C:\MinGW64
  • Configure your system and add C:\MinGW64\bin to the PATH
  • Download the tools (bsdtar, diff, patch, gnufind, bzip2 and xz) to C:\MinGW64\bin (or any other directory in the PATH);
  • Open Bash;
  • Go to the scripts directory: cd /c/mingw-build/scripts
  • Execute the ICU build script: ./icu-55.1-w64-amd64.sh
  • If the build is successful the icuc-55.1-w64-amd64.tar.xz file is created in the C:\mingw-build\dest directory;
  • Go to the MinGW64\bin directory: cd /c/MinGW64
  • Uncompress the ICU package: bsdtar xzf /c/mingw-build/dest/icuc-55.1-w64-amd64.tar.xz
  • Go back to the scripts directory: cd /c/mingw-build/scripts
  • Execute the Boost build script: ./boost-1.59.0-w64-amd64.sh
  • If the build is successful the boost-1.59.0-w64-amd64.tar.xz file is created in the C:\mingw-build\dest directory;
  • Go to the MinGW64\bin directory: cd /c/MinGW64
  • Uncompress the Boost package: bsdtar xzf /c/mingw-build/dest/boost-1.59.0-w64-amd64.tar.xz
  • Now you have a MinGW-w64 installation with the Boost libraries

Please send your feedback: comments, suggestions and bug reports!!

DISCLAIMER: the scripts are provided "as is" without warranty of any kind.

Tuesday, February 11, 2014

Qt 5: QStandardPaths::DownloadLocation returns Documents folder starting from Vista

In Qt 5 the QStandardPaths provides access to the (guess what?) system standard paths like user's documents path, fonts path, etc.

There is also a Downloads path (QStandardPaths::DownloadLocation) that should return the directory where downloaded files are stored. Starting with Windows Vista there is a special directory for downloads. Before that the Documents directory was used.

However the Qt implementation of QStandardPaths does not make use of this new directory and always returns the Documents (QStandardPaths::DocumentsLocation) when the Downloads location is requested.

This patch fixes this issue, now QStandardPaths::DownloadLocation will correctly return the Downloads directory for Vista (or greater).

The patch has to be applied to file qtbase\src\corelib\io\qstandardpaths_win.cpp
And it is good for both Qt 5.2 and 5.2.1

Thursday, December 12, 2013

MinGW Distro - December 2013 Edition

DISCLAIMER: this is a private, custom build of MinGW. It is neither supported nor sponsored by MinGW.org

Updates: GCC 4.8.2, GDB 7.6.1, Boost 1.55.0, ICU 52.1, SQLite 3.8.1, cURL 7.33.0, wxWidgets 3.0.0, POCO Libraries 1.4.6p2, Apache Portable Runtime 1.5.0, Apache Portable Runtime Utils 1.5.3

MinGW-Distro-Addons.exe - 77 Mb - Full with add-ons
SHA1: 029334806ff1ca1cadc1fd7cdbfeaa5a9fd4f9ad

This is the latest version I will provide. Unfortunately I have no time to keep track of the updates, work on patches and build the packages. In a next post I will make scripts and patches available for anyone that would take them and continue.

Sunday, August 11, 2013

MinGW Distro - August 2013 Edition

DISCLAIMER: this is a private, custom build of MinGW. It is neither supported nor sponsored by MinGW.org

Updates: Boost 1.54.0, cURL 7.31.0, PCRE 8.33, FreeType 2.5.0, wxWidgets 2.9.5, xz 5.0.5

Added: Apache log4cxx 0.10.0, Apache Portable Runtime 1.4.8, Apache Portable Runtime iconv 1.2.1, Apache Portable Runtime Util 1.5.2

The ICU static libraries were removed. Now only ICU DLLs.

MinGW-Distro-Addons.exe - 73 Mb - Full with add-ons
SHA1: a73ddf6141535fd55935b083d86ddbdedcc291de

MinGW-Distro-Core.exe - 16 Mb - Core Components
SHA1: 6be8fd7ec3e65c6f25e4194dec9355d2ce7a9b00

For more information visit MinGW Distro

Saturday, June 08, 2013

CodeLite 5.1 Project Templates for wxWidgets

CodeLite Templates

CodeLite is a nice open-source, cross plataform C and C++ IDE. One of its nicest features is the project templates. With them you can easily create a project from a template.

CodeLite 5.1 includes some templates to create wxWidgets projects. Unfortunately those templates do not work very well with my MinGW Distro.

The June 2013 edition contains the corrected templates. You can find them in the MinGW\ide directory.

Please copy those files to the directory templates\projects of your CodeLite installation.
In the future the Distro will come with additional templates for CodeLite.

Monday, June 03, 2013

MinGW Distro - June 2013 Edition

This release was delayed because of the last minute release of GCC 4.8.1

Updates: GCC 4.8.1, GDB 7.6, GraphicsMagick 1.3.18, SQLite 3.7.17, ICU 51.2, freeglut 2.8.1, libpng 1.6.2, libarchive 3.1.2, grep 2.14, zlib 1.2.8, GLFW 2.7.8, NASM 2.10.07, libxml2 2.9.1, file 5.14, binutils 2.23.2, FreeType 2.4.12

Added: LINQ for C++ 20130203, libharu 2.2.1

MinGW-Distro-Addons.exe - 75 Mb - Full with add-ons
SHA1: 4ab44b4b303f3090489d4bef721728d9f97106fb

MinGW-Distro-Core.exe - 16 Mb - Core Components
SHA1: 51acdd76db532697e53133368df21550898d5623

For more information visit MinGW Distro

Saturday, May 18, 2013

Building Qt5 with MinGW

Building Qt with MinGW was always a nightmare: weird conflicts, a lot of patching and the result was not good.

Now with the recent release of Qt 5.0.2 things are a little better (hope they get even better with forthcoming Qt 5.1). I finally managed to build (or almost - QtWebkit fails to build, see below) it.

The steps I took are outlined below. If you want to try please let me know if they have worked for you too.

Qt building

Steps to Build

You'll need:
Steps
  • Make sure Perl, Python and MinGW are all in your PATH
  • Create a directory C:\Qt-build
  • Create a directory C:\Qt
  • Uncompress the Qt source distribution to C:\Qt-build
  • Remove directories qtwebkit and qtwebkit-examples-and-demos. For some reason they do not build
  • Create a directory C:\Qt-build\build. You will get a tree like this:
    C:\
      Qt-build
        build
        qt-everywhere-opensource-src-5.0.2
  • Open the "MinGW Command Prompt"
  • Enter cd C:\Qt-build\build
  • Enter touch ..\qt-everywhere-opensource-src-5.0.2\qtbase\.gitignore
  • Enter ..\qt-everywhere-opensource-src-5.0.2\configure -prefix C:\Qt -release -developer-build -opensource -shared -opengl desktop -qt-pcre -nomake tests
  • Enter mingw32-make
  • Enter mingw32-make install

The Qt headers and libraries will be installed in C:\Qt

Thursday, April 04, 2013

GCC 4.8.0 build failing for MinGW

GCC 4.8.0 was released on March 22nd, so in time for April's release of the MinGW Distro.

Unfortunately it failed miserably to build. It is a known problem.

I hope that by the next release of MinGW Distro this problem is already fixed. I'll keep you informed.

Wednesday, April 03, 2013

MinGW Distro - April 2013 Release

Updates: Boost Libraries 1.53.0, cURL 7.29.0, ICU 51.1, libpng 1.5.14, libxml 2.9.0, libxslt 1.1.28, POCO 1.4.6p1, SQLite 3.7.16, OpenSSL 1.0.1e, GLFW 2.7.7, GMP 5.1.1, wget 1.14, gettext 0.18.2.1

Add: rapidjson 0.11

MinGW-Distro-Addons.exe - 75 Mb - Full with add-ons
SHA1: 4ab44b4b303f3090489d4bef721728d9f97106fb

MinGW-Distro-Core.exe - 16 Mb - Core Components
SHA1: 51acdd76db532697e53133368df21550898d5623

Friday, February 08, 2013

OpenSSL 1.0.1d and cURL 7.29.0

It happened again, now with OpenSSL and cURL. New versions of these libraries were released. See below how to update them. As with Boost before the next MinGW distro will include the updated OpenSSL and cURL.
Assuming you have installed it in C:\MinGW directory:
  • Clean up the existing cURL files:
cd C:\MinGW
rmdir /s /q include\curl
rmdir /s /q include\openssl
rmdir /s /q ssl
cd C:\MinGW
bin\bsdtar -xvJf curl-7.29.0.tar.xz
bin\bsdtar -xvJf openssl-1.0.1d.tar.xz

Boost C++ Libraries release 1.53.0

The new release (1.53.0) of Boost Libraries was made available on February 4th, just 3 days after I released the Feburary 2013 edition of my MinGW distro that included release 1.52.0. Because of this I have built the new release and I'm making it available here as a separated download. As usual it also includes the ICU versions of both Boost RegEx and Boost Locale libraries. The next release of the MinGW distro will contain this version of Boost (or a newer if released meanwhile).
Assuming you have installed it in C:\MinGW directory:
  • Clean up the existing Boost files:
cd C:\MinGW
rmdir /s /q include\boost
del lib\libboost*.*
cd C:\MinGW
bin\bsdtar -xvJf boost-1.53.0.tar.xz

Friday, February 01, 2013

MinGW Distro - February 2013 Release

By demand the add-on libraries have been included in the main package.

Updates: FreeType 2.4.11, GLEW 1.9.0, ICU 50.1.2, libssh2 1.4.3, libgmp 5.1.0, POCO 1.4.6, SQLite 3.7.15.2, jpeg 9

MinGW-Distro-Addons.exe - 75 Mb - Full with add-ons
SHA1: dbdf784f741efa0c0aa8cb3640bbb4dcbc45b707

MinGW-Distro-Core.exe - 16 Mb - Core Components
SHA1: 97b13f4ce75dc48f536c0c350a35758373125de5

Friday, December 14, 2012

auto overused

I had recently read on an article on a programming subject not related to C++11 but which uses C++11 constructs to explain the point. It is nice to see that C++11 is being adopted this way. However one thing that scared me was the overuse of auto keyword.

const auto MAXSIZE = 10000;

for (auto i = 0; i < MAXSIZE; ++i)
{
...
}

This chills me to the bone. Why not use int or size_t? Of course this simple code doesn't show the complete threat that is the overuse of auto. But this introduces a culture where is OK to use auto everywhere.

My feeling about auto is that it is a tool best fitted for generic programming or where writing the type is difficult, complicated or impossible. Compare this:
std::vector<int> v;

for (std::vector<int>::const_iterator it = v.begin(); it = v.end(); ++v)
{}

with the better:

std::vector<int> v;

for (auto it = v.begin(); it != v.end(); ++v)
{}

but this is even better and clearer:
std::vector<int> v;

for (int &i : v)
{}


Excessive use of auto can lead code that is hard to read and to maintain. Maintenance is all about code reading. Please take care.

Sunday, December 02, 2012

Why another XML parsing library?

Some may have noted that in the December 2012 release of my MinGW Distribution I have included yet another XML parsing library: pugixml. Why this if it already has libxml2?

Well, while libxml2 is a complete, standard-compliant XML parsing library it lacks a DOM interface. With DOM it is easier to handle and to walk through the XML representation.

I have evaluated many simple to use, fast libraries: RapidXML, FastXML, AsmXML. And, of course pugixml. However pugixml is fast, has a good documentation and a DOM-like, modern interface that fits well with STL and C++11 ranged-for and lambdas. That was I was looking for.

MinGW Distro - December 2012 Release

Some people have reported that my website is down. Unfortunately depending where in the world you are the site is accessible or not. I'm investigating this issue with my hosting provider. Because of this issue and to ease the release process, this and next releases will be published here, in this blog in addition to the website.

MinGW Distro - December 2012 Release

Updates: binutils 2.23.1, Boost 1.52.0, PNG 1.5.13, TIFF 4.0.3, cURL 7.28.1, GraphicsMagick 1.3.17, POCO 1.4.5, SQLite 3.7.14.1.
New: pugixml 1.2

MinGW-Distro.exe - 43 Mb - Full
SHA1: 92d09d316c17da21c1607ba0938f260b67c8b8b8

MinGW-Distro-Core.exe - 16 Mb - Core Components
SHA1: b3ad4e5e587c915b25acbabd1fdfa0edda69d93f

Friday, November 23, 2012

Building OpenSSL applications

An user has reported problems building an application that use OpenSSL libraries supplied with my MinGW Distro. While he didn't provide further details I think his problem was related to some missing library dependencies.
Any application using OpenSSL has to link with (in this order): ssl, crypto, ws2_32 and gdi32. ssl and crypto are the OpenSSL libraries themselves. ws2_32 is the import library for the Winsock DLL WS2_32.DLL and gdi32 is the import library for GDI32.DLL. The latter is needed because, on Microsoft Windows, OpenSSL uses windows events (eg, mouse movements) as an entropy source.
If you are using a IDE (like Codelite or Code::Blocks) make sure to add those libraries to the project settings.