[Beowulf] multiline string literals...
mas at ucla.edu
Tue Jan 13 09:51:18 EST 2004
> This is a teeny bit off-topic, but I don't know where else to find a
> group of knowledgeable systems programmers.
> Does anybody here know WHY multiline literals, e.g. specifically
> something like:
> char usage = "
> Usage: foobar [-h] [-v] -f barianfile
> -h for help
> -v for verbose
> -f barianfile to specify your foo-bar-barian
> are deprecated in gcc?
Probably because it's hard to tell the difference between the above and
an unbalanced double quote character? An unbalanced quote could
eat a big hunk of your code and possibly without any error messages...
Try this instead:
char usage = "\n"
"Usage: foobar [-h] [-v] -f barianfile\n"
" -h for help\n"
" -v for verbose\n"
" -f barianfile to specify your foo-bar-barian\n"
See ANSI C standard section 6.1.4 String literals which says that
adjacent strings literals are concatenated into a single string.
PS: You need either *usage or usage. -Wall is your friend...
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
More information about the Beowulf