C++ function for a Perl guy

C++ and Perl programming tomes, photo by Thomas Guest on Flickr

Feeling a bit homesick for Perl with all this C++ I’ve been writing of late, so I did this. It even forces me to put a newline just like my beloved Perl print function.

#include <iostream>

void print(const std::string message) {
   cout << message;

Now that I think about it, we could even bring a touch of home to my Ruby side:

#include <iostream>

void puts(const std::string message) {
   cout << message << endl;

I giggled incessantly when writing these, due perhaps to sleep-deprived, broken-ankle, exam-anxiety induced state.

Alternatively, I could have just done this:

#include <string>
#include <stdio.h>

void print(const std::string message) {

But we all know how much C++ folks love when we mix in C stuff that has a C++ equivalent. I think I’ll stop now. #fallsasleep

Photo by Thomas Guest on Flickr.

Liked this post?

Feel free to throw me a cup of coffee or an Amazon Wish List item. Cheers!

You can also comment to @Rubenerd, or email weblog@rubenschade.com. Let me know if you don't want your comment posted.