Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASCII Art comments in C/C++ headers and code files

I watched with great interest the Mojang "Mojam" for Humble Bundle (link might not be valid for a long time), and throughout the video, I saw some great things on how these guys use their code.

One of these things was that one of the developer use ascii art comments in his code to better navigate around.

This gives something like this:

/////////////////////////////////////////////
//      ___  ___       ___   _   __   _    //
//     /   |/   |     /   | | | |  \ | |   //
//    / /|   /| |    / /| | | | |   \| |   //
//   / / |__/ | |   / / | | | | | |\   |   //
//  / /       | |  / /  | | | | | | \  |   //
// /_/        |_| /_/   |_| |_| |_|  \_|   //
//                                         //
/////////////////////////////////////////////
int main()
{
    // do some stuff
    return 0;
}

This may look bad right there, but associated with editors like Sublime, it becomes powerful, because the "zoomed out" view that Sublime exposes lets you read that text and navigate in your code like a breeze.

Now, there are plenty of cool ascii art text generators out there. But none of these (at least those I looked at) generate C++/C compliant text.

Meaning: I have to manually add the comment slashes (//) all around to make it go along in the code.

Do you guys use this trick?
If yes, do you have a tool to generate these "comments" around the text?

like image 596
Gui13 Avatar asked Feb 20 '12 14:02

Gui13


1 Answers

Recently, when I was searching something in my .php file with list of routes for a site, I've decided to make such big ASCII comments. And now, I use them (not in all source files, but for example in long config files), and these comments really help to navigate.

Here is how it looks in my Sublime Minimap:

enter image description here

So far, I didn't automate the process of creating such comments. I use online ASCII creator from this site. I use font "basic"

like image 62
Larry Cinnabar Avatar answered Sep 22 '22 09:09

Larry Cinnabar