Why allow concatenation of string literals?

Sure, it’s the easy way to make your code look good:

char *someGlobalString = "very long "
                         "so broken "
                         "onto multiple "
                         "lines";

The best reason, though, is for weird printf formats, like type forcing:

uint64_t num = 5;
printf("Here is a number:  %"PRIX64", what do you think of that?", num);

There are a bunch of those defined, and they can come in handy if you have type size requirements. Check them all out at this link. A few examples:

PRIo8 PRIoLEAST16 PRIoFAST32 PRIoMAX PRIoPTR

Leave a Comment