Thread: help! string literals

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Meldreth
    but it's ok if it gives wrong results as if they were right.
    I think that what vart is getting at is that the behaviour is unspecified for an unmatched double quote. It did take some time for cakestler to even specify what was meant by a "string literal".

    EDIT:
    Quote Originally Posted by Meldreth
    you think a program can give incorrect results on incorrect input but shouldn't ever crash.
    If the behaviour is undefined, then the output would not be wrong.

    Quote Originally Posted by Meldreth
    silently wrong output can be mistaken for correct output, a crash can't be overlooked.
    That is not an argument in favour of a crash though. Both incorrect output and crashes are Bad Things.
    Last edited by laserlight; 02-05-2009 at 09:36 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Generally, it is more annoying, however, if a program crashes since it loses all its state, what you've entered, and so on.
    Incorrect output might not be as extreme as that, but it is true that it might too be Bad. Although usually, another bad thing is behind the wrong output, such as undefined behavior. And that, as we know, is pretty much the worst thing of all things.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String Class
    By BKurosawa in forum C++ Programming
    Replies: 117
    Last Post: 08-09-2007, 01:02 AM
  2. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  3. How to concatenate, then widen string literals
    By lonehacker in forum C Programming
    Replies: 13
    Last Post: 09-15-2004, 10:56 AM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM