help! string literals

This is a discussion on help! string literals within the C Programming forums, part of the General Programming Boards category; Originally Posted by Meldreth but it's ok if it gives wrong results as if they were right. I think that ...

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,630
    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 08:36 AM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    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.

Page 2 of 2 FirstFirst 12
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, 02:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

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