Geeks With Blogs

News Bob Taco Industries is an ISV focused on game and app development for Microsoft platforms headed up by Michael B. McLaughlin. Mike is a Microsoft Visual C++ MVP (previously an XNA/DirectX MVP from 2011-2013), a developer, a writer, a consultant, and a retired lawyer. If you're a developer who is just getting started, consider checking out the BTI website's section for developers for links to code samples and other helpful sites.
Bob Taco Industries Blogging Division

Over the summer I worked with SyncFusion to create an eBook based off of my C# to C++ guide for their free Succinctly Series of eBooks. Today the result, C++ Succinctly, was published for download. It is a free (registration required; they make tools and libraries for .NET development so you might get an occasional email from them – I’ve been signed up for a few months and have had maybe 3 emails total so it’s not horrible super spam or anything Smile ) and you can download it as a PDF or a Kindle .MOBI file (or both).

I’m excited with how it turned out and enjoyed working with the people at SyncFusion. The book contains a total of 20 code samples, which you can download from BitBucket (there’s a link very early in the book). Almost all of the code is also inline in the book itself so that you don’t need to worry about flipping back and forth between your dev machine and your eReader (but if you want to try to understand a concept better, you can easily download the code, open it up in VS 2012, and play around with it to see what happens when you tinker with things).

The code does require Visual Studio 2012 because of its expanded support for C++11 features and since I wrote all of the samples as Console programs for clarity and compactness, you will need a version that supports C++ desktop development (currently VS 2012 Pro, Premium, or Ultimate). Sometime this Fall, Microsoft will be releasing Visual Studio 2012 Express for Windows Desktop which should provide a free way to use the samples.

That said, I tested all of the samples with MinGW and only the StorageDurationSample will not compile with it due to the thread-local storage code. If you comment that out then you can compile and run all the samples with MinGW (or using a recent version of GCC in a GNU/Linux environment, or any other C++ compiler that provides the same level of C++11 support that Visual Studio 2012 does).

I hope it proves helpful to those of you who choose to check it out!

Posted on Friday, September 7, 2012 6:20 PM C++ | Back to top

Comments on this post: C++ Succinctly now available!

# re: C++ Succinctly now available!
Requesting Gravatar...
Hi, you can get the recent version of gcc (4.7.2) for Windows from here:
Left by Hassan on Oct 18, 2012 3:19 AM

# re: C++ Succinctly now available!
Requesting Gravatar...
Just looked at "Program Entry Point" section. Please note that "int main()" is perfectly legal in accordance with the International Standard. It might be somewhat better/easier solution than "(int /*argc*/, _pchar* /*argv*/[])" making this step unnecessary: "By
commenting out the parameter names, you ensure that you will not accidentally use them."
Left by MD on Oct 19, 2012 8:00 AM

# re: C++ Succinctly now available!
Requesting Gravatar...
I considered that, but decided against it because I wanted to introduce readers to portability issues, didn't want to obscure how to get the command line arguments, and thought I might actually use them in one or two samples at the time that I first created that construct. The explanation of it at the beginning was one of the last things I wrote.

In hindsight it would have been good if I had at least mentioned int main(void) as an option, though.
Left by mikebmcl on Oct 19, 2012 1:08 PM

# re: C++ Succinctly now available!
Requesting Gravatar...
Thanks for the reply!

Sounds fair enough, esp. if you use the command line arguments.

I normally start and recommend others (esp. those transferring from another language) to start with the empty parameter list to avoid compiler warnings about unused parameters (since compiling with the highest level of compiler warnings is another good practice at this stage and using compiler-specific pragmas to suppress the individual warning would be too messy -- it's also a bit easier to explain that commented-out param. names in the beginning) -- YAGNI and all that ;-) I guess pedagogical reasons you mention might make sense in this case, perhaps...

// BTW, strictly speaking, "void" is not necessary in C++ (and doesn't pop up that often) for the empty parameter list, only in C: -- that being said, "The parameter list (void) is equivalent to the empty parameter list." (8.3.5 [dcl.fct] paragraph 2), so it's not an error, either.
Left by MD on Oct 19, 2012 7:51 PM

# re: C++ Succinctly now available!
Requesting Gravatar...
To void or not to void... for me I always put void unless code style for the project is not to.

It's a signal to me and anyone else looking at the code that the function intentionally takes no parameters and not that there should've been something there but it was deleted by accident. Not so important for standalone functions but it can be helpful for virtuals (and especially abstracts) if they are later overridden in a derived class.
Left by mikebmcl on Oct 19, 2012 9:45 PM

Comments have been closed on this topic.
Copyright © Michael B. McLaughlin | Powered by: