Single character commenting

Technology

It’s a pretty common practice to comment and uncomment big chunks of code during the development and testing of software. Here’s an odd little hack from the ajaxian blog that can make this a little easier for blocks that you’re constantly flipping on and off during development.

For C style comments, the following will be commented out:

/*
if ( foo == bar )
{
  dosomething();
  return();
}
// */

And the addition of a single ‘/’ will uncomment the block:

//*
if ( foo == bar )
{
  dosomething();
  return();
}
// */

In languages that don’t have the single line comment, such as CSS, you can do the same thing with only the block level comments.
Commented:

/*/
min-height:100px;
/**/

Uncommented:

/**/
min-height:100px;
/**/

You are probably talking to your screen right now, saying, “hey Jason, that commenting trick is marginally useful at best.” I can only respond by reminding you that every keystroke is a beautiful and unique snowflake that must be cherished and never wasted.

A neat commenting trick – Link

19 thoughts on “Single character commenting

  1. rwx says:

    I’d vouch for MMC Replay instead.

    http://www.vesalia.de/e_mmcreplay.htm

    Just put your stuff on memory card, no need for cables or another computer to depend on.

  2. Anonymous says:

    yes. and it works. i use it for several years now – so i can use the great 6581 chip :)

    before i found this dos-2-c64 thingi i did it with my amiga – and from my amiga to my pc-harddrive so it was a three-way option.

  3. Monsigor Funkibut says:

    Don’t give up on those old floppies as goners just yet. I decided to back up all my 5.25″ disks to CD-RW and I know some of them had not been touched in 20 years and they still all read fine.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK