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

Programming Topics

Options:
View Article Map
View Archives
do...while
Description :

What can be said about C’s everyday do...while loop? It just does something while some condition holds. End of story, right?

No, of course not. That would make the title of this small article silly, so let’s cover two topics.


Category: [ CVu Journal Vol 16, #1 - Feb 2004 ]
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: [ CVu Journal Vol 16, #1 - Feb 2004 ]
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: [ CVu Journal Vol 16, #1 - Feb 2004 ]
Student Code Critique Competition 26
Description : This item is part of the Dialogue section of C Vu, which is intended to designate it as an item where reader interaction is particularly important. Readers’ comments and criticisms of published entries are always welcome.
Category: [ CVu Journal Vol 16, #1 - Feb 2004 | Student Code Critiques from CVu journal. ]

  |<   <<   31   32   33   34   35   36   37   38   39   40   >>   >|
Sort by Date Title