Danger of Using Double Slash Comment◀ Danger of Using Slash Star Comment▶ Can You Spot Bugs? Amazon
n my first year of programming, I always used // to comment my program because I thought it was a more convenient way than using /* and */. As time went on, I realized that /* and */ are a lot better for the following reasons:
- They can enclose lines after lines of comments.
- They usually improve readability of a program.
- You can be sure that whatever between /* and */ always stays as comments whatever platform to which you transport your code.
The final reason is the main reason. I use Microsoft Notepad to code, and after I am done I send it to my computer science account for compiling or other purposes. I’ve found that when I display my code in a text editor, sometimes comments after // are wrapped into multiple lines and the subsequent lines are not seen as comments any more.
To correct the problem, I need to make them comments again by either adding more // or by adding /* and */.
From then on, I started to adopt /* and */. This way I am rest assured that whatever meant to be comments always stay as comments wherever my code is transported.
Next we'll look at a series of bug spotting exercises!
The back of the refrigerator is painted black because black radiates heat more quickly.
◀ Danger of Using Slash Star Comment▶ Can You Spot Bugs?