Recent content by degibson

  1. degibson

    What do you consider competent knowledge of a language?

    Just don't follow this reasoning inductively :) My feedback for putting a language on a resume is to do so iff: - You can answer coding interview questions in that language, and, - You can talk about your last project in that language in a way that makes you look good to an interviewer...
  2. degibson

    Are most authors of OSS hobbyist developers?

    Not really clear what you mean here... ?
  3. degibson

    Multiplying in C++

    Hint: Find out what '%' does.
  4. degibson

    YAC++Q: Why use operator overloading

    Where C++ provides a ==, it does fine. But I can't think of a non-native type for which I'd rather have == than a method called Equals().
  5. degibson

    memset an array of bytes

    A per-byte strategy ignores the requirement I had inferred from the original description: 4-byte-wide operation. That was just a guess on my part, trying to infer what OP wanted... but you're right about the endianness, and about the readability. memset() is typically heavily optimized for...
  6. degibson

    memset an array of bytes

    Your example is a little confusing. "0123" is five bytes (NUL terminator in there), but your example output discards the NUL? Anyway, assuming you want 'data' filled with ASCII 012301230123... with no NUL terminator, and assuming that 'data's size is a multiple of 4, and assuming C++: assert(0...
  7. degibson

    YAC++Q: Why use operator overloading

    IMO, there are essentially no good reasons to overload operators*. You always want behavior to be explicit. Operators can hide arbitrary code behind them -- that keeps me up at night. *Exception: operator= and operator() occasionally justify an overload. The former when you must copy and...
  8. degibson

    The open close principle and refactoring

    Usually for me something demonstrably incorrect trumps a problem that just smells wrong. I guess if I ever ran out of work, I might refactor based only on smell, but that hasn't happened yet.
  9. degibson

    In C if I write a single char to disk will it just be the single char or will it

    No trailing null. One byte is one byte. Unless you're using a library that adds one; I recommend you don't do that. 1 bytes = 8 bits = 2 hex digits. 1 hex digit = 4 bits.
  10. degibson

    How do I define the _LARGE_FILE_API macro in c?

    This is not something you typically define yourself; if your system supports it, it will already be defined.
  11. degibson

    C fread question number of bytes left I need more help please

    fstat64() for gigantic files. http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fapis%2Ffstat64.htm
  12. degibson

    C fread question number of bytes left I need more help please

    stat() is what you're looking for.
  13. degibson

    Why do people even bother to try writing encryption algorithms?

    Wow. If they're actually calling that routine... Ignorance? Incompetence? Dishonesty? Malice?
  14. degibson

    creating a script to delete TONS of files

    How many files are you keeping? Maybe it'd be simpler to copy out all the files you're keeping then del the entire remaining directory?
  15. degibson

    Coding styles for C-family languages

    Well, enums are compile-time constants, so it does sorta follow that enums and compile-time constants would have a similar style suggestion. As for why kSomething is used instead of SOMETHING for compile-time constants, it's to differentiate from MACROS. "Until January 2009, the style was to...