Title: Are my
Description: comments good?
Kylevision - August 9, 2003 03:23 AM (GMT)
| CODE |
///////////////////// //Functions example// //kylevision.com // ///////////////////// #include<iostream.h>//header file void greet();// declare the function called greet void main()//main function { greet();//tells it to use greet function }
void greet() //greeting function { cout<<"Greetings!"<<endl; //what void greet() does }
|
Do I do commets well enough?
Sam Fisher vs Solid Snake - August 9, 2003 03:41 PM (GMT)
to make it look nicer do one or two comments above each function or if it is really important put it ther but otherwise putting comments on nearly everyline is going to get pretty annyoing
FHCandyman - August 9, 2003 05:01 PM (GMT)
its good for displaying what everything means, but I wouldnt do that for all your examples. Also, put a little space between the code and the comment, looks cleaner. when you do examples, you only explain things that general beginners wont understand. some of your comments should be clumped together at the very bottom, explaining the thing you commented on before. When people are reading your code, they usually are reading it to learn something specific, thus you need to note those thing and only those things.
Sam Fisher vs Solid Snake - August 9, 2003 05:20 PM (GMT)
yeh that sounds like it would be better, if this is for beggining users dont explain it like that it looks like a bundle of crap, put comments near the top and/or the bottom,unless there is something really importasnt
ih8censorship - August 9, 2003 07:55 PM (GMT)
if its a short tutorial maybey make several files in a zip or several examples on a page. that way if there super new they can learn more and if there a little more experienced they can use the less commented version. oh yeah can you make a functions example with the function definition instead of the function prototype where it is declared? thats what i do it saves a lot of de bugging cause it declares/is the prototype and it is the definition all in one neat package.
Sam Fisher vs Solid Snake - August 9, 2003 08:56 PM (GMT)
make tuttorails that cover evry little aspect of c++
FHCandyman - August 10, 2003 12:32 AM (GMT)
>> oh yeah can you make a functions example with the function definition instead of the function prototype where it is declared? thats what i do it saves a lot of de bugging cause it declares/is the prototype and it is the definition all in one neat package.
isnt that called inline? i was just wondering because i have completely forgotten what inline is and that sounds familiar. if that is inline, a tutorial on that would be really good. if its not, a tutorial on inline would be helpful anyway :lol:
Sam Fisher vs Solid Snake - August 10, 2003 01:15 AM (GMT)
oh yeh add more jk, sry we been tellin you to do alot
FHCandyman - August 10, 2003 01:24 AM (GMT)
well i dont think that was an example example, just an example of how he does comments, so im sure he'll have more in actual examples. and some examples only need that much, IE Hello World
Sam Fisher vs Solid Snake - August 10, 2003 01:33 AM (GMT)
FHCandyman - August 10, 2003 03:15 AM (GMT)
i took a look at your websites examples. In hello world, you should point out that void main means that it will return no value. in the functions, you should say that at the top, instead of "tells it to use greet function", should be "declares greet function", or "tells main() to use greet function"
also, "what void greet() does" should be "tells greet() to display 'Greetings!' on the screen."