CS3520: Programming in C++

Home

Book Notes

Notes for Murach’s C++ Programming, 2nd Edition, 2022, ISBN 978-1-943872-96-1
ChapterPageBookNote
1 12 "...an executable file on macOS typically has an extension of .app." A .app is a special kind of macOS package that typically contains an executable (along with other files), but isn't itself the executable file. On macOS, like on Linux, executables typically have no extension.
2 47 It’s considered a good practice to initialize a variable before you use it since that allows you to be sure of the initial value that’s assigned to the variable. Variables of built-in types must be initialized before use, otherwise undefined behavior results.
4 116 "month += 1; which is equivalent to month++;" x += 1 is equivalent to ++x (not x++).
5 149 fail() returns true if failbit is set. Otherwise, returns false. According to the documentation, fail() returns true if either failbit or badbit is set.
6 189 char has "typical size" 1 byte. char is always exactly one byte (1 == sizeof(char)).
12 443 Movie m2(); // partially abbreviated syntax This does not call the default constructor, but declares a function.
17 649 char letter; // sets aside 1 byte of memory (usually) for variable letter char is always exactly one byte (1 == sizeof(char)).
17 668 Resource Acquisition Is Instantiation Resource Acquisition Is Initialization
17 671 // copy assignment operator Use a check for self-assignment in the copy assignment operator.
17 673 // move assignment operator Consider using a check for self-assignment in the move assignment operator.

Notes for Murach’s C++ Programming, (1st Edition), 2018, ISBN 978-1-943872-27-5
ChapterPageBookNote
1 12 "...an executable file on macOS typically has an extension of .app." A .app is a special kind of macOS package that typically contains an executable (along with other files), but isn't itself the executable file. On macOS, like on Linux, executables typically have no extension.
2 47 It’s considered a good practice to initialize a variable before you use it since that allows you to be sure of the initial value that’s assigned to the variable. Variables of built-in types must be initialized before use, otherwise undefined behavior results.
5 149 fail() returns true if failbit is set. Otherwise, returns false. According to the documentation, fail() returns true if either failbit or badbit is set.
6 187 char has "typical size" 1 byte. char is always exactly one byte (1 == sizeof(char)).
6 187 unsigned long is typically 8 bytes, unsigned long long is typically 4 bytes. unsigned long long can't be smaller than unsigned long (sizeof(long) <= sizeof(long long)). (Possibly the book switched their sizes.)
12 457 strncat(s1, s2, size - 1); Could concatenate up to size - 1 characters and overrun the buffer. Should be: strncat(s1, s2, size - strlen(s1) - 1);
14 529 Movie m2(); // partially abbreviated syntax This does not call the default constructor, but declares a function.
17 637 char letter; // sets aside 1 byte of memory (usually) for variable letter char is always exactly one byte (1 == sizeof(char)).
17 656 Resource Acquisition Is Instantiation Resource Acquisition Is Initialization
17 659 // copy assignment operator Use a check for self-assignment in the copy assignment operator.
17 661 // move assignment operator Consider using a check for self-assignment in the move assignment operator.