Where to split a string literal

Posted by quinmars on Stack Overflow See other posts from Stack Overflow or by quinmars
Published on 2010-03-31T22:42:50Z Indexed on 2010/03/31 22:53 UTC
Read the original article Hit count: 275

Filed under:
|
|

Every time I have to split a long string literal into two (or more) pieces, because it does not fit into a single line, I have to decide if I split the text before or after a space.

For example:

const char * long_text1 = "This is a long text, which does not fit "
                                "in one line";
/* or */
const char * long_text2 = "This is a long text, which does not fit"
                                " in one line";

I tend to use the first way, but I do not have a real reason for it. So I wonder is there any advantage to favor one of them? I know this questions tend to be coding style question, but that's not my intend. I only want to know if there is a convincing reason why one of those two ways might be preferable.

© Stack Overflow or respective owner

Related posts about c

    Related posts about string