bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile error in current CVS, src/server.c:5500


From: Mark D. Baushke
Subject: Re: Compile error in current CVS, src/server.c:5500
Date: Mon, 21 Jul 2003 12:46:38 -0700

Derek Robert Price <derek@ximbiot.com> writes:

> Mark D. Baushke wrote:
> 
> >Derek Robert Price <derek@ximbiot.com> writes:
> >
> >> Do you know when split strings began being supported?  C89?
> >
> >Yup.
> >
> >There was much contention and debate during drafts of the ANSI C
> >standard, but I am fairly sure that ANSI/ISO 9899-1990 (aka C89) is the
> >first one to force the behavior (section 6.1.4 "String Literals").
> >
> >Where the grammer is
> >
> >  Syntax:
> >    string-literal
> >     "s-char-sequence[opt]"
> >     L"S-char-sequence[opt]"
> >    s-char-sequence:
> >     s-char
> >     s-char-sequence s-char
> >    s-char
> >     any member of the source character set except
> >         the doulbe quote ("), backslash (\), or new-line character
> >     escape-sequence
> >
> >So you will note that the new-line character has never actually been
> >a formal part of the string-literal without being escaped. It is only
> >in recent compilers that this is being enforced.
> >
> >In ISO/IEC-9899-1999 (aka C99), the same syntax is provided (but it is
> >now in section 6.4.5 String Literals). The only real change is that the
> >text of the description and semantics has been expanded for
> >clarification and the single-quote clarified as having two
> >representations (either "'" or "\'").
> >
> 
> This doesn't seem to specify the:
> 
>     "some text\n"
>     "some more text "
>     "even more text\n"
> 
> style strings.  Do you know if that is supported C89+?  

Actually, C89 DOES specify that two string-literal tokens that are
adjacent they become one string in the Semantics clause of the secion.
(Sorry, I was being a bit lazy in not including the descripton or the
semantics in my last message... I'll still be lazy and not include the
description from the C89 spec which I only have in hardcopy -- any typos
are mine :-).

Semantics

    In translation phase 6, the multibyte character sequences specified
    by any sequence of adjacent character string literal tokens, or
    adjacent wide string literal tokens, are concatenated with a single
    multibyte character sequence. If a character string literal token is
    adjacent to a wide string literal token, the behavior is undefined.

> Or should we be sticking with the ugly:
> 
>     "some text\n\
> some more text even more text\n"
> 
> style strings?

If we want to move to C89 support everywhere, then

  char text[] = "Hello " "world!\n";

is equivalent to

  char text[] = "Hello world!\n";

and will have a \0 byte after the \n in both cases.

        Enjoy!
        -- Mark




reply via email to

[Prev in Thread] Current Thread [Next in Thread]