Go Back   Flash Flash Revolution > General Discussion > Chit Chat
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 09-15-2005, 06:58 PM   #1
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 33
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default #if

So I remember learning about a year ago that you could use #if/#if 0 to basically comment out immense portions of code, no matter what types of comments or nested comments there were in the code. This was really handy in robotics when we made some code that could have been better (we had a "Code Graveyard", complete with an Ascii grave and flowers), but I kind of forgot the syntax for it. Can anyone help? Does anyone know whether it is complier-specific or or whther it will also work in C++?

Thanks in advance. I know the question was a little odd and a bit specific, but hey, if someone tells me the syntax again, it would be extremely handy.

Oh, and I would just ask the people in robotics, but those who were good at programming in the club basically all left to go to universities. Arun's quite good, but I don't think he knows this, because I asked him earlier.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline   Reply With Quote
Old 09-15-2005, 07:30 PM   #2
ad0gg
FFR Player
 
Join Date: Dec 2003
Location: At My House
Posts: 989
Default RE: #if

If you want to comment something out in C++, you can use // to comment a single line or /* and */ to comment out a large block of code (or anything else you want). I have never heard of #if/if# 0 before.
__________________
ad0gg is offline   Reply With Quote
Old 09-15-2005, 07:59 PM   #3
lightdarkness
Summer!!
Retired StaffFFR Veteran
 
lightdarkness's Avatar
 
Join Date: Jul 2003
Location: New York
Age: 35
Posts: 11,308
Send a message via AIM to lightdarkness Send a message via MSN to lightdarkness Send a message via Yahoo to lightdarkness Send a message via Skype™ to lightdarkness
Default RE: #if

You're thinking of /*

*/

But # is allowed in some languages as signifiying a comment.
__________________
lightdarkness is offline   Reply With Quote
Old 09-15-2005, 08:15 PM   #4
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 33
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default RE: #if

Um, no, that is not what I am thinking of. I am definitely thinking of #if.

Eh.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline   Reply With Quote
Old 09-15-2005, 08:58 PM   #5
soccr743
FFR Player
Retired Staff
 
soccr743's Avatar
 
Join Date: Dec 2003
Posts: 549
Send a message via AIM to soccr743 Send a message via MSN to soccr743 Send a message via Yahoo to soccr743
Default RE: #if

What you are talking about is compiler ifs. Although I personally have never used them yet, the syntax should be like this:

#if <Statement using #defined variables only>

exit(0);

#endif

If the statement is true, then the compiler compiles the code within that if... If not, then it is left out of the program.

-----Soccr743-----
__________________
soccr743 is offline   Reply With Quote
Old 09-15-2005, 09:35 PM   #6
QreepyBORIS
FFR Player
 
QreepyBORIS's Avatar
 
Join Date: Feb 2003
Location: It is a mystery.
Age: 33
Posts: 7,454
Send a message via AIM to QreepyBORIS Send a message via MSN to QreepyBORIS
Default RE: #if

A-ha!

I think the syntax for the MASSIVE coment-out is like this:

#if 0
//There is stuff in here.
#endif

I am almost certain that's how it went. Thank you, soccr. It's actually really handy when you want to just take huge blocks out of your program in no time without deleting the code.
__________________

Signature subject to change.

THE ZERRRRRG.
QreepyBORIS is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:48 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution