You’ve probably already heard, but there’s a big upcoming C++ conference from everyone’s favourite friendly software giant, Microsoft. Actual seats are, of course, all booked up. But you can watch online. If you can spare the time, watch as many as you can. It’s a great opportunity to learn the language from the big names of the industry, including Bjarne Stroustrup himself! And they’ll be available on demand, as well as live, so there’s no excuse to miss them. Have fun!
Hi again! Firstly I want to confirm that I probably won’t be writing many more SFML tutorials until a stable SFML 2.0 is released. Unless – of course – a stable release is still a very long way off!
Anyway, I feel I should provide something in the mean time so I’ve decided to pick up my C++ tutorial series again. As some of you may know, I have already put one or two videos on YouTube on this topic and the blog has a few pages related to it. And don’t worry if you already know C++, as I’m sure many of you do. Hopefully some of the later tutorials will be interesting for you as well – I’ll try to make explanations fairly complete so you’ll still be able to take something from videos.
Now, I have some ideas as to the ‘syllabus’ I’m going to follow. Let me know what you think – anything I’ve missed out, things I should remove until later, or simply a few re-orderings.
- Introduction to C++, GCC and Code::Blocks
- Hello World! Program
- Statements, expressions and operators
- Variables and more operators
- Conditionals – if, else and switch; boolean variables and operators
- Loops – for, while and do while
- Functions – arguments and return types etc; inline functions
- Larger projects – multiple source files, header files, IDE projects
Hi there! Was just wasting away my time clicking the ‘random‘ button on xkcd (just joking – time on xkcd is never wasted), when I came upon this programming related sketch which I thought I’d share. Enjoy!
I’ve just recorded a short video introducing you to C++0x. Unless you’ve been living under a rock for the past few years, or don’t have an internet connection (and somehow still frequent my blog) then chances are you know about it anyway. You may well have been reading Dr. Stroustrup’s FAQ, my own C++0x articles, or some of the many other sources available on the new standard.
Anyway, this video is going to be the first in a series that will cover C++0x features in video form, rather than textual. Enjoy!
Thought you might like to ssee C++0x support for various compilers. Here is a list for GCC, or you can check out this comparison, which features many of the major compilers: Digital Mars’, Intel’s, Microsoft’s, IBM’s and, of course, GCC.
You’ll see that GCC has better support than many, which is in fact why I’ve recently switched from Microsoft Visual Studio to Code::Blocks and/or Qt Creator. I might post a little more about my experiences thereof at a later date. In particular, notice that both MSVC and GCC support long long and nullptr (about which I posted late yesterday). Indeed, long long has unanimous support across all the compilers mentioned in the chart.
And what about the last part of the title? Well I’ve been continuing to say C++0x (and probably will still do so), but as we can expect it’s release sometime this year, I guess I should start saying C++11. Ah well, I probably won’t. That is all.
I’m going to mention two little C++0x features today. I don’t have much time, but I thought I may as well share them briefly. They’re both fairly small and quick to explain, so let’s get to it. I’ve put the one that’s faster to discuss first. As always, check out Dr. Stroustrup’s FAQ for more information.
I. long long Integers
The C++0x standard has a new type – the long long integer – which is guaranteed to be at least 64bit. No more annoyances because too many compilers make int and long int the same size – use long long int and you can be sure that you’ll get 8 whole bytes of integral goodness!
Apparently this feature was already supported by a number of compilers, but it’s standard now so you don’t have to worry about non portable code (well you do, but you can blame compiler vendors for being slow to comply with the new standard… ). There’s really not much to say here, merely that you have two 64bit types: long long (i.e. long long int) and unsigned long long (i.e. unsigned long long int). Also note the new literal suffixes: LL for long long and ULL for unsigned long long.
This one’s exactly as the name suggests: that is, the nullptr keyword represents a null pointer. Previously one might have done something like this:
char* name = 0;
In C++0x, however, one can do the following instead:
char* name2 = nullptr;
These two examples have the same result, that is name == name2 would evaluate to true. On the other hand, while we can also assign the value o to an integral type, we can assign nullptr only to a pointer variable. So the following would yield a compiler error:
int age = nullptr; // compiler error: age is not a pointer
This is all well and good, but it’s quicker to type 0 than nullptr. Why, therefore, should we use the latter over the former? Well the fact is that the double meaning of 0 as the integer 0 and as the null pointer 0×00000000 has the potential to cause problems. Allow me to demonstrate using Dr. Stroustrup’s example. Consider a function f with two overloads:
- void f(int)
- void f(char*)
We call f(0). What happens? Well in fact, f(int) is called, but what if we wanted to pass a null pointer to f(char*). Previously we should have had to resort to something like f((char*)0), which is rather undesirable, in my opinion at least (and, presumably in the opinion of committee members!). So, do the right thing and use nullptr to represent your null pointers.
As you know, I’ve now started to provide prebuilt SFML 2.0 binaries, downloadable from Google docs. Previously you had to subscribe to the blog by email to get them. However, one or two of you weren’t too keen on this, so I’ve decided to place a link here.
If you’ve already subscribed by email to get them, don’t feel short changed. You’ll still come out on top. I intend to regularly update the binaries, and I’ll send email subscribers an email notification with the new link as soon as the files are online. This page will be updated as well, but I shan’t be able to do it as frequently. Also, of course, you won’t be reminded to download a new version if you’re not subscribed by email.
In fact, I’ll take this opportunity to remind you: to get prompt notification of updated SFML 2.0 binaries, including builds for different platforms, then subscribe to the blog by email if you haven’t already. Just enter your email address on the right and click ‘Sign me up’; if you’re logged in to WordPress, you probably won’t need to enter the email address.
However, if you really don’t want email notifications and prefer to subscribe via WordPress or using the RSS feed then fear not. You can download the binaries on my new downloads page – you just might get updates a little less frequently.
Disclaimer: All the files provided in these downloads are AS-IS. I cannot guarantee that they are suitable for purpose, and nor can I be held accountable or responsible for any damages caused by them, even if I was advised of such. Note also that SFML is developed by Laurent Gomila. I do not intend to imply by this service that I am in any way affiliated with him. I compile the binaries from his source and provide them to you merely as a convenience.
The blog’s been quiet for quite a while now, for which I apologise. Basically, my work has dragged on longer than expected, but hopefully I’ll be able to continue soon.
But to the title of the post. My computer is becoming old and too hot, so I am upgrading one or two components and switching case. I also want to reinstall Windows, but there’s no point doing that until the hardware’s been changed. Why should you care? Well basically, I am meaning to upload some prebuilt SFML binaries, but to do so I want to install Visual C++ Express 2008 and 2010 in order to provide the widest range of development options I can. However, my computer is not in a fit state for extra junk right now and frankly I don’t want two of the same IDE on the primary desktop. Therefore, what I’ll do is run it off Virtual PC. Once again, however, I don’t want to get knee deep in that kind of thing until my desktop is new and improved.
Anyway, I hope you won’t lose interest in the mean time, and I’ll try not to keep you waiting too long!