It's my understanding that the printf() function is declared as
int printf(const char * restrict format, ...);
in stdio.h. And loosely speaking, if a parameter is declared as
restricted, then accesses to the object must go through that parameter.
Does this mean that
printf("%s", "%s");
is illegal if the string literals are coalesced into the same pointer?
printf() would be accessing the same object through different
parameters, one of which is declared as restricted.
Another possibility is
printf("%s is tricky", "is tricky");
since the string literal objects can again overlap even though their
pointers have different values. Is that code potentially illegal?
Thanks for your thoughts,
-Peter
--
Pull out a splinter to reply.
int printf(const char * restrict format, ...);
in stdio.h. And loosely speaking, if a parameter is declared as
restricted, then accesses to the object must go through that parameter.
Does this mean that
printf("%s", "%s");
is illegal if the string literals are coalesced into the same pointer?
printf() would be accessing the same object through different
parameters, one of which is declared as restricted.
Another possibility is
printf("%s is tricky", "is tricky");
since the string literal objects can again overlap even though their
pointers have different values. Is that code potentially illegal?
Thanks for your thoughts,
-Peter
--
Pull out a splinter to reply.
Comment