Errors in preprocessing.

This is a discussion on Errors in preprocessing. within the C++ Programming forums, part of the General Programming Boards category; >But also....for some reason endl; makes my compiler freak out. std:: likes to hide from me too. I don't ever ...

  1. #16
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    >But also....for some reason endl; makes my compiler freak out.
    std:: likes to hide from me too. I don't ever forget to put him there, he just runs off when I'm trying to figure out where one of his buddies ran off to elsewhere in the code. Damn namespaces...

    LOL

    >Also, in this case what do you mean by buffer?
    Most systems will allocate a big array to hold characters. They'll fill that array up and then write the contents to the device or file you want because it's more efficient than writing a single character the instant they get it. It's like caching, but the same.

    Is the size of the array OS dependent?

    >And are there other ways to flush this buffer?
    std::flush. It works like endl, but doesn't print a newline. Or you could just wait for the buffer to get filled up or the program to terminate.

    So if the buffer fills up it automatically clears? And if you terminate the program this buffer is also cleared?
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  2. #17
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Is the size of the array OS dependent?
    Yes, and implementation dependent, and any other kind of dependent you can think of. But it doesn't matter because there are two kinds of output that are relevant: interactive, and non-interactive. You only need to actively consider flushing for interactive output. Everything else is fine because it gets where it's going eventually but interactive output needs to go there now because users hate to wait. Ironic that I/O is the slowest part of a program, no?

    >So if the buffer fills up it automatically clears?
    Or the system crashes catastrophically. I think that MS-DOS did that. It's really the only explanation.

    >And if you terminate the program this buffer is also cleared?
    Yes, all streams are flushed, closed, and tidied up in general.
    My best code is written with the delete key.

  3. #18
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    Ahh, thanks for all the help Your wisdom is unparalelled.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 04:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 11:50 AM
  3. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 09:00 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21