Comment by don-code
I agree this seems overly principled to me.
I recall a DSP class where there was an exam with a question like (not exactly this):
> What does the following code print?
> `printf("Hello, world!");`
If you responded with:
> Hello, world!
...which - of course - the whole class did, you got the question wrong.
If you responded with:
> "Hello, world!"
...which is actually not what that would print, you got the question right.
A small band of us went to the professor and noted that, in fact, `printf("Hello, world!")` does not print the quotes. But he wanted us to show that it printed a string, and we denote strings by quotes.
This was something that we learned to do just for him - all strings had to be enclosed by quotes, to denote that they were strings. As far as I'm concerned, it served no practical purpose; we never had to differentiate strings like "Hello" from ['H', 'e', 'l', 'l', 'o', 0] or other representations.
A better example of how this could go - and not one that had anywhere near the same stakes - was a question on the entrance exam for my college radio station:
> What is the airspeed velocity of an unladen swallow?
I got this question right by answering, "Ni!"
(edit: formatting)
Yeah that sucks, the hard life lesson where you have to swallow your pride and go "fine, I will put quotes on the infernal thing"
But... it does not print a string, a string goes into it but what comes out of the function is not that programmatic feature we call a string in any way shape or form, what comes out depends on the output device specified, it may be ink on paper, lit phosphors, or a stream of bytes. none of which can you use in your program as a string.
sprintf being a notable exception of course. there you do get a string out of it.
Update: language is weird and the more I read my statement the weirder it gets, all I can do is add this cryptic note. "When you print a string it does not produce a string", this usually means I am wrong about something.