The One Character Block Comment
vancelucas.com
vancelucas.com
There's a chance you'll confuse yourself (or your code reviewer or other reader) and spend an hour debugging to find what you thought was commented out wasn't. That's not worth it to save one keystroke.
I agree with you, though. Once you're done with your experiment, reset the commented lines to something more conventional.
So I agree, this hack is more trouble than its worth.
Unless you're trying to work them around CSS comment hacks!
The example code here made me immediately think of the lines of code that caused the Debian SSL catastrophe.
:)
#if 0
...
#endif
One character, no comment syntax hacks. 2//**/2
== 1) ? "C" : "C++"e.g. http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#...
It totally fails with crappy C compilers that decide to feature C++ comments unannounced. IIRC gcc does this unless you give -ansi or -std=c89. And C99 officially supports the // -comments but hasn't got C++ features, of course.
But yeah, I sometimes take for granted how nice VS.NET is at these little detail things (though I use resharper-style CTRL+/ bindings for this particular feature). Thanks to this author and his pain for reminding me how good we have it.
Excuse me, but last time I checked PHP was one of the most widely deployed languages in the world, which a lot of people smarter than you and I spend their working time hacking. Can we please stop the PHP bashing.
PHP is popular. But the language sucks. Big-time. Popularity does not mean something is automatically good, in a technical sense.
I don't mean to say that PHP is a perfect language by any means, far from it. My point was more that just because some code example is written in PHP you can't automatically infer that the code is inferior. I personally think that's terribly arrogant, but that may just be me.
Perhaps I'm terribly arrogant but I do make that inference. Simply because the number of good coders who would pick PHP when given a choice is very, very, very, very, very, very, very, very, very, very, very small. And shrinking.
I'm sure that if it was up to the programmers many big sites would be hacked out in Haskell, but as it is an awful lot of them happen to be done in PHP. And Coders have jobs and bosses.
I've done my share of PHP development over the years, and have clients to this day that need their PHP sites maintained. And every time I need to touch those sites, I wish I had a tool powerful as, say, ColdFusion Studio 4.5, which came out in 2001.
If you can point out such a development environment for PHP, I'd be quite grateful.
//line 1
//line 2
//...
//line N
...and... line 1
line 2
...
line N
...with more flexibility than using a syntax trick.Or, in Plan 9's acme editor, we just highlight the desired text and execute the following command in the tag area: Edit s/^/\/\//g
Then when we're ready to go back, we just select again and do: Edit s/^\/\///g which is the same as the previous command but with one forward slash moved.
Alternately, in almost every case it's easy enough to just stick in /* */ comments around it and delete them as necessary.
I think a lot of people really missed the point here, and used comments as a way to flaunt their clearly more impressive and infinitely superior geek prowess by using IDEs and emacs.
The point was to present a solution that was fairly platform and language agnostic. If I had included an IDE shortcut in the article, I would have had to go through a long list of all the IDEs out there and all their corresponding shortcuts. I would have then been inevitably flamed for missing some or for not representing a specific programming language.
Oh, and don't forget to bash PHP or point out how much I suck at programming for using PHP. Because everyone knows only cool developers and true geeks don't use PHP.
isn't this just a horrible workaround for not having a debugger?