kjwcode: *sigh* (phoebe sigh)
2011-10-08 11:22 pm
Entry tags:

htonl()/ntohl() considered unportable?

The subject of today's fooling about was hton?() and ntoh?(). Probably more C than C++ there, and much more reading than playing with code, to be honest. Mostly, I spent time rolling the concept that that family of function is "not portable" around in my head. I'm trying to decide if the pedants are coming out to play on that one ("but it won't work on a 36-bit VAX running BSD 4.2 with patch..."), if the concept of switching natural host order to MSB (or simply doing nothing if it's already MSB) is more difficult than I give it credit for, or whether I just don't understand the thrust of that argument. I'm going to guess at the latter.

For all I can tell right now, it seems like people just want another excuse to write their own routine that does exactly the same thing to show how clever they are, or possibly to avoid getting real work done. I think it akin to writing one's own string class for no better reason than you're convinced you can do better than whatever STL implementation you use. In turn, I liken that to hand-tweaking the assembly output of your compiler because you think you can do better (excess hubris, rather than the rare times where it actually makes sense). It's one of those urges I've outgrown, thankfully.
kjwcode: assert("it's going to be okay"); (it's going to be okay)
2011-09-29 09:58 pm
Entry tags:

C++11 rough cuts

Like most new language standards, C++11 currently lacks a book describing what's new and giving some examples. Sure, you can skip from site to site and blog to blog and put it together for yourself, but I'd rather spend more time learning than searching.

I did some searching for books that might fit the bill and found two.

C++ Primer Plus, Sixth Edition wasn't in the top search results, but it's the one I bought based on the reputation of earlier editions. It's currently in pre-publication "rough cut" phase, but O'Reilly lets readers follow as the book's being worked on. Needless to say, I'm a big fan of that way of doing things! I don't need perfect information just yet -- I just need a bunch of pushes in the right direction.

The other book I found is Professional C++, 2nd Edition. I'm not as familiar with Wrox books as I am with O'Reilly, and I didn't see any sort of early access program. This book is also probably slightly ahead of my C++ skill level, as I still need the occasional extra bit of information to get things to click. At any rate, this book is due to be published in October.

At any rate, I'm happy to have something to work from. If you know what the perfect next step after C++ Primer Plus is, please let me know.
kjwcode: Segfault. (compiler complaint)
2011-09-27 09:32 pm
Entry tags:

C++11 catch-up

Catching up on C++11 and C++ in general now. On one hand it doesn't feel like it makes sense, given that Perl is such a versatile tool, and I don't really do anything important, anyway. On the other hand it feels like it's worth checking out now that the new standard is out.

I've seen the C++0x label for so long that I've taken to calling C++11 C++0xB instead. I'm sure I'm not the first to think of it, but it amuses me somewhat.