Posts: 3,368
Threads: 195
Joined: Jan 2003
Wrong...
# = shift + "3"..
// = two "/" presses..
' = one "'" press..
/* */= two shift presses and two "/" presses...
Here's a question:
What are the possible quotes in C? Just a '?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 3,279
Threads: 170
Joined: Nov 2003
Depends on the context, the function, and the compiler. ' and " are both used depending on these things.
I'd knock on wood, but my desk is particle board.
Posts: 1,752
Threads: 21
Joined: Jun 2002
Quote:Wrong...
# = shift + "3"..
// = two "/" presses..
' = one "'" press..
/* */= two shift presses and two "/" presses...
Wrong about what? I still say # is "less" typing than //, because you can hold down shift as you hit the 3, in one motion, whereas // requires two presses and releases.
Posts: 3,279
Threads: 170
Joined: Nov 2003
For me, quickly tapping // is easy peasy, but using Shift + 3 requires a brief moment of premeditation and then a hand stretch. // is faster for me.
I'd knock on wood, but my desk is particle board.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Quote:Agamemnus Wrote:Wrong...
# = shift + "3"..
// = two "/" presses..
' = one "'" press..
/* */= two shift presses and two "/" presses...
Wrong about what? I still say # is "less" typing than //, because you can hold down shift as you hit the 3, in one motion, whereas // requires two presses and releases.
Not for me. A double tap of the slash is perfect.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 1,138
Threads: 211
Joined: Feb 2020
It depends on your keyboard # is right above the shift key for me(shift 3 is a pound sign for me).
It would be nice if you could 'mod' the QB ide to add things easily, I know you can(looks at the person/people who changed some text to make it look like their own compiler).
Posts: 3,616
Threads: 287
Joined: Jan 2003
Get the source code for the IDE (good luck :o ), program a few operations...like if you tap SHIFT-R, it could add a REM.
But who cares, eh?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 614
Threads: 87
Joined: Aug 2001
Quote:For me, quickly tapping // is easy peasy, but using Shift + 3 requires a brief moment of premeditation and then a hand stretch. // is faster for me.
Exactly my thoughts
Posts: 1,956
Threads: 65
Joined: Jun 2003
Oracle,
At first glance, your challenge to remove comments from C code looks relatively easy. I haven't needed to use C in about 6 years, so I dug up some of my old C programs and took a look.
The first question in my mind is: Why would you want to strip the comments from a C program anyway? Is this a practical requirement or just an exercise?
While scanning over 100 C programs, I couldn't find the // prefix for on-line comments. I only found the leading /* and the trailing */ even if the comment was only on a single line. Are you sure the // option exists on all versions of C?
Anyway, my review of the programs came up with the following sticky considerations:
1) It's possible that /* or */ or // could appear inside of a quoted string, and some quoted strings are delimited by double quotes (") and others by single quotes ('). So every time the program finds one of these supposed comment delimeters, it would have to do several scans to make sure that they were not found within quoted strings, which of course would have to be ignored. This is not as easy as it sounds. Watch out, 'cause the comments themselves could contain either of the quotes or even embedded delimiters themselves.
2) An absolute "must" requirement is that the C source code has already been successfully compiled. You can appreciate that if the source code has errors, then the comment removing program will go bananas. In any event, the program will have to detect certain fatal errors, like a multi-line comment that has no subsequent */ terminator.
3) Another "must" is to successfully compile the new uncommented code and then compare the object code to the original. If they don't match, then the comment remover doesn't work.
Since you mentioned "C style" programs, perhaps the program will have to ask the user up front what comment delimeters he wants to use. Maybe this can be on a little parameter file as input.
In summary, if you have a practical use for this program, I'd be interested in taking a crack at it. If it's just an exercise, I'll pass.
*****