Qbasicnews.com

Full Version: C Style commenting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Oooooh, I get it. You thought I meant that the program should remove comments inside strings Tongue. No I don't mean that, I mean what you say Smile
Moneo: FSM's are often used in game development as well; in particular, games like Street Fighter and Mortal Kombat and their 23874873264785326487 clones. I'm writing an article on applied FSM's for the next QBOA which covers techniques applied primarily to fighting games.

Anyways...I'll write up something in the next couple of days for this thingo, I might have time but I dunno for sure. Time's a lil slim at the moment. Sad
Quote: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 '?

Aga...just to rehash...

/**/ is actually really easy-fast. use the num pad...ta-da da-ta...with the index/middle finger....and...the ability to block anything from part of a line to many lines with one ta-da/da-ta pair is really nice.

Happy new year, people
actually, unless you are using international layout, typing a ' is faster than going to the numpad cuz you have to move your hand across the keyboard for a /**/ as opposed to right beside the enter key with '. Aga's still right. (In US international layout (dunno about any others) hitting the ' key will delay the typing and wait for the next key you press. If it's a vowel or "y" it will accent it, if not then it will just type a '+the key you pressed next.)
The // comment is now legal in the C99 standard: http://gcc.gnu.org/c99status.html.

Also, if you are writting a comment remover for C, then it needs to replace comments with a single space for it to be legal, otherwise you can do this.

Code:
int a, b, ab;

a/* Token paste */b = 10;

Which will look like this after removing comments (incorrect):
Code:
int a, b, ab;

ab = 10;

When it should be:
Code:
int a, b, ab;

a b = 10;

Which doesn't compile. This is why the token paste operator (##) got introduced.
Ok, so gotta watch out for:

//
/*
*/
'
"

What about:
" ' ' "

Is that allowed? Or just '' and ""
Oracle, why would you give extra points for custom, non-C comments for a C comment removal program? :???:
Cos it's not really a "C comment remover" -- just a program to remove "comments" in general.

Loose's "comments" taken aboard Wink (if anyone is entering???)
OK, I suppose I can make 'em CONSTs... I had another question in that post, though..
The " ' ' " thingywhatsit?

What's special about that?

If this clarifys, you'll get bonus points for ignoring quotes that are delimited by a \ (backslash).

And quotes inside ' marks should be ignored... like this:

Code:
$foo = '<a href="foo.com">Foo</a>';

The double quotes should be ignored. Though this is an advanced feature, so don't bother if it can't be done or whatever.


No entries yet... someone send me *anything* and you'll be winning :lol:
I'm working on it now.

I made a qb decommeNter before, but making a generic one where Moneo doesn't start analyzing every single line is a different matter. Big Grin
Pages: 1 2 3 4 5