C++ function for a Perl guy
SoftwareFeeling 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) { printf(message.c_str()); }
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.