Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Debugging

Name: Anonymous 2011-02-11 23:11

Graduating this May with BS in CS and I've only ever debugged with couts or printlns.  Am I doing it wrong?  No one ever taught us how to use a built in debugger so I guess it's not that important?

Name: Anonymous 2011-02-12 6:32

>>4
For file I/O, developers in the know use the lowest level file I/O system calls. On POSIX systems, this means using open, close, read, write, lseek. On Windows, this means, CreateFile, CloseHandle, ReadFile, WriteFile, SeekFile. They also use asynchronous file I/O to read in large portions of files at a time in another thread without blocking.

For logging messages, they'll build an abstraction system with runtime polymorphism that allows for log messages to be written to a variety of sources, whether that be the terminal, a file of a particular format, over a network, to a debugger window or IDE, or a database. Behind that, they may use printf or cout, but it's all abstracted away, they aren't using printf/cout directly.

Iostreams in C++ have a huge cost performance wise, they use shit tons of virtual calls, way more than is necessary, and that means lots of cache misses every time you use them for I/O. So at the very least, most developers use printf if they have to.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List