Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C Style commenting
#31
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
Reply
#32
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
I'd knock on wood, but my desk is particle board.
Reply
#33
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
Reply
#34
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.)
igitalblackie.com - Done! Smile Ask about our hosting Wink

-Goddess of the of the No More Religion Threads movement Smile
Reply
#35
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.
esus saves.... Passes to Moses, shoots, he scores!
Reply
#36
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? :???:
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.
Reply
#37
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???)
Reply
#38
OK, I suppose I can make 'em CONSTs... I had another question in that post, though..
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.
Reply
#39
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:
Reply
#40
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
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)