ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Programming Topics or Overload Journal #123 - October 2014

Options:
View Article Map
View Archives
All A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other
Code in Comments
Description :

We have all seen comments in source files which look more like executable code than documentation.

The first line in the body of the for loop below is such a comment: you might expect to be able to remove the leading slashes and have code which compiles and runs, but functions slightly differently.

What did the author of this comment intend?

Example 0

for (Surfaces::iterator sf = surfaces.begin();
     sf != surfaces.end();
     ++sf) {
  // std::cout << "Drawing: " << *sf << "\n";
  sf->draw();
}

OK, I’m being disingenuous. I’m aware that the comment isn’t really a comment, it’s commented-out code. And, like any tolerant and capable programmer, by examining the surrounding context I can guess why this code has been commented out.

This article examines how to comment out code, then describes various problems which lead to code being commented out, before finally arguing that there’s often a better solution to these problems.


Source : Hand entered.
Category: [ Programming Topics | CVu Journal Vol 16, #1 - Feb 2004 ]
Code Rot
Description : Maintaining code is vital to keep it working. Tom Guest explores what happens when you neglect it.
Category: [ Programming Topics | Overload Journal #92 - August 2009 ]
Come Code With Me
Description : Alan Griffiths outlines an Open Source project and invites contributions.
Category: [ Programming Topics | CVu Journal Vol 28, #2 - May 2016 ]
Comment on “Problem 11”
Description :

The first step here in finding problems in the code is to identify the problem the code is trying to solve. The discussion in the C Vu article is basically about curiosities in the way in which the C++ standard library std::istream is defined, but I will make the perhaps unwarranted assumption that what the problem the code is really about is not the uses of std::istream, but rather, more generally, how to write a read routine that can effectively and safely capture data from an input stream. Actually as the first problem below illustrates neither of these issues can be effectively addressed without the other.


Category: [ Programming Topics | CVu Journal Vol 16, #1 - Feb 2004 ]
Comment Only What The Code Cannot Say
Description : Comments can help or hinder. Kevlin Henney assesses when to avoid them.
Category: [ Programming Topics | Overload Journal #157 - June 2020 ]
Commenting programs, how and why
Description : A letter has flooded in from Colin Masterson, the author of our series on structured programming:
Category: [ Programming Topics | CVu Journal Vol 1, #2 - Dec 1987 | Letters to the Editor ]
Comments Considered Evil
Description : We are taught that adding comments to code is a good thing and adds value. In practice this value is seldom, if ever, realised. Mark Easterbrook makes the case for a better way.
Category: [ Programming Topics | Overload Journal #73 - Jun 2006 ]
Comments Considered Good
Description : In our last issue, we offered the case against comments; in this issue, William Fishbourne responds in defence. He argues that it is not the practice of commenting that it is evil, it is the thoughtless commenter.
Category: [ Programming Topics | Overload Journal #74 - Aug 2006 ]
Commit Checklist
Description : Chris Oldwood goes through the motions of version control.
Category: [ Programming Topics | CVu Journal Vol 28, #5 - November 2016 ]
Compile-time Data Structures in C++17: Part 1, Set of Types
Description : Compile time data structures can speed things up at runtime. Bronek Kozicki details an implementation of a compile time set.
Category: [ Programming Topics | Overload Journal #146 - August 2018 ]
Compile-time Data Structures in C++17: Part 2, Map of Types
Description : Compile time type selection allows static polymorphsim. Bronek Kozicki details an implementation of a compile time map.
Category: [ Programming Topics | Overload Journal #147 - October 2018 ]
[ C and C++ | Development Techniques | Programming ] Compilers and Compiler Generators
Description : This site provides an on-line edition of the text and other material from my book "Compilers and Compiler Generators - an introduction with C++", published in 1997 by International Thomson Computer Press.
Added on : 10 February 2006 23:58:19 +00:00
Compiling a Static Web Site Using the C Preprocessor
Description : Sometimes the obvious way is still too complex. Sergey Ignatchenko relates how ‘No Bugs’ Bunny found an unexpectedly simple approach to creating a web site.
Category: [ Programming Topics | Overload Journal #108 - April 2012 ]

  |<   <<   11   12   13   14   15   16   17   18   19   20   >>   >|
Sort by Date Title