Go to Post Someone want to channel their inner Mark Leon and do the math? - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-01-2004, 21:15
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Lightbulb Comments

Question: Why doesn't anyone use single-line comments?

the /* */ doesn't nest.

Like:
Code:
//This is a one line Comment.

/* Commented_Out_Code();
 /* this is a multi-line
     Comment in Code */
 This_Code_Still_Executes(); */

/* Commented_Out_Code();
 // this is a multi-line
 // comment in code
 // split into single-line
 // comments
 This_Code_Dont_Execute(); // :ahh:  */
The reason I say this is that you can use /* */ for commenting out and debugging.

Isn't it good coding practice to do this anyway?

Plus, It isn't in the default code, Anywhere.
  #2   Spotlight this post!  
Unread 18-01-2004, 21:38
KevinB's Avatar
KevinB KevinB is offline
Registered User
AKA: Alum
no team
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2001
Location: AL
Posts: 188
KevinB will become famous soon enoughKevinB will become famous soon enough
Send a message via ICQ to KevinB
Re: Comments

The way I've always understood it was that /* */'s were the only way to use comments in C. When C++ came along, it added the // style comments. Therefore: //'s aren't a part of standard C, only C++.

That probably explains why a lot of people don't use them: they don't expect them to work! However, you are correct in saying that the Microchip compiler does seem to allow them.

So // away!
  #3   Spotlight this post!  
Unread 18-01-2004, 21:40
Rickertsen2 Rickertsen2 is offline
Umm Errr...
None #1139 (Chamblee Gear Grinders)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2002
Location: ATL
Posts: 1,421
Rickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant futureRickertsen2 has a brilliant future
Send a message via AIM to Rickertsen2 Send a message via Yahoo to Rickertsen2
Re: Comments

Quote:
Originally Posted by Astronouth7303
Question: Why doesn't anyone use single-line comments?

the /* */ doesn't nest.

Like:
Code:
//This is a one line Comment.

/* Commented_Out_Code();
 /* this is a multi-line
     Comment in Code */
 This_Code_Still_Executes(); */

/* Commented_Out_Code();
 // this is a multi-line
 // comment in code
 // split into single-line
 // comments
 This_Code_Dont_Execute(); // :ahh:  */
The reason I say this is that you can use /* */ for commenting out and debugging.

Isn't it good coding practice to do this anyway?

Plus, It isn't in the default code, Anywhere.
I have wondered the same thing. It gets quite annoying trying to comment out blocks of code that contain multiline comments.
__________________
1139 Alumni
  #4   Spotlight this post!  
Unread 18-01-2004, 21:44
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Comments

It would seem like Whoever wrote the default code would know about //. :shrug:

I actually got the idea from NQC, a C-like language for LEGO's RCX
  #5   Spotlight this post!  
Unread 18-01-2004, 23:14
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Comments

my standard practice is to make comments that actually say something single-liners "//", and use "/* */" for commenting out blocks - that way there is no conflict.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Give some comments to 114's animation Brian Yip 3D Animation and Competition 14 21-04-2003 23:47
I would be remiss (and some other misc. comments) archiver 1999 0 23-06-2002 23:13
Another idea looking for comments archiver 1999 16 23-06-2002 22:01
The FIRST Forum - coming August 1st - Your comments wanted skrussel General Forum 3 09-07-2001 00:49


All times are GMT -5. The time now is 19:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi