[cs631apue] snapshot feedback

Jan Schaumann jschauma at stevens.edu
Fri Nov 15 15:52:55 EST 2019


Hello,

Rather than send you individual feedback, here's
feedback based on all your submissions.  Most of it
applies to all of you anyway:

- remember to include your git log in your final
  submission

- your .c files should each include all the standard
  headers it needs itself; don't have e.g. a file
  "myheader.h" that includes <stdio.h> etc.

- remember to protect your own headers against
  double-inclusion via

#infdef MY_HEADER
#define MY_HEADER
stuff goes here
#endif

- it's easier to comment out large chunks of code by
  using

#if 0
dozens of lines here
#endif

  than by trying to use '/* ... */'.

  However:

- remember to remove commented-out code blocks prior
  to final submission

- recall the different feedback I've given you in
  class or in previous assignments; chances are, some
  of it applies to your code here, too.

- remember to remove debugging output (e.g. printf
  statements) prior to final submission; a better
  approach might be to write a debug function that
  only prints messages if the program was compiled with
  e.g. -DDEBUG:

void
debug(const char *fmt, ...) {
#ifdef DEBUG
	va_list args;
	va_start(args, fmt);
	vprintf(fmt, args);
	va_end(args);
#endif
}

- remember to use consistent style; if one of you
  writes code one way and the other another, you need
  to find agreement; fortunately, that's really easy
  here, since you have a style guide - use it

- be careful not to mix indentation styles (spaces vs
  tabs); a good code editor should highlight or
  otherwise notify you of mixed spaces

- make sure your files do not have non-Unix EOL; you
  are supposed to be writing code _in the Unix
  Environment_

- remember to support IPv4 and IPv6; be careful to
  avoid needless code duplication

- when supporting ~ directories, do not assume "/home"
  is the home directory; you have to get the correct
  home directory from the struct passwd for the given
  user

- make sure the return type of your function is
  meaningful; if you have a function of type 'bool'
  that always returns true, then that is not useful

...and make sure to always check the return value of
any function that can fail!

Happy Coding!

-Jan


More information about the cs631apue mailing list